What's the best way to learn perl for a python programmer?

V

vj

I've been given a project which requires writing scripts that need to
be run on over 3000 servers. Only about 15% of them have python
installed on them. While all/most of them will have perl.

I'll try and do as much as possible in pexpect but am sure I'll have do
some significant perl. Any suggestions on what is the best way to get
upto speed on perl?
 
J

Jorge Godoy

vj said:
I've been given a project which requires writing scripts that need to
be run on over 3000 servers. Only about 15% of them have python
installed on them. While all/most of them will have perl.

I'll try and do as much as possible in pexpect but am sure I'll have do
some significant perl. Any suggestions on what is the best way to get
upto speed on perl?

Writing to c.l.perl is a good start...

Perl has very good docs. IMHO, they're better than Python's, specially for
the examples.

Also, starting with a book like "Learning Perl" is not bad and it might save
you a lot of time with the basics and the semantics of the language.

c.l.perl is very receptive and helpful.

--
Jorge Godoy <[email protected]>

"Quidquid latine dictum sit, altum sonatur."
- Qualquer coisa dita em latim soa profundo.
- Anything said in Latin sounds smart.
 
G

gene tani

vj said:
I've been given a project which requires writing scripts that need to
be run on over 3000 servers. Only about 15% of them have python
installed on them. While all/most of them will have perl.

I'll try and do as much as possible in pexpect but am sure I'll have do
some significant perl. Any suggestions on what is the best way to get
upto speed on perl?

There's lots of resources on the web, like
http://llama.med.harvard.edu/~fgibbons/PerlPythonPhrasebook.html
http://perl.active-venture.com/Porting/pumpkin-gotchas.html

Maybe get 1 or 2 books, recommended:
Perl Debugged (scott/wright)
Effective Perl (Hall/ Schwartz)
Debugging Perl (brown)

o-o perl books (really well-written but I'm not going to represent that
these books are easy to read),
O-O Perl (Conway)
Learnign Perl O-O (Randall schwartz)
 
P

Paddy

Tell 'them' you need a uniform installation of your scipting language
across all servers to ensure correct operation of your script then
ensure its python that gets loaded ;-)

I took a course in perl from Well House Consultants in the UK, which
was good; then had an immediate use for perl, which helped me remember.

I used the Well House manual and the Camel book for reference.
(http://www.wellho.net/ - Tell Graham Paddy sent you).

P.S. I don't have any connection to Well House, apart from learning
Perl through them.

- Paddy.
 
J

john_sips_tea

The online docs are very good. Just run "perldoc perl", and then go
through the various tutorial pages (starting with "perldoc perlintro").
You can also read them online here: http://perldoc.perl.org/perl.html .

Then go to http://www.perlmonks.org . They have many tutorial-style
articles there, as well as a very helpful and knowledgeable community.

If you absolutely need to write object-oriented Perl, you probably want
to keep things as simple as possible and just use regular old
hash-based objects. Writing OO Perl code is a whole nuther ball of wax
than just writing procedural Perl code.
 
S

Serge Orlov

vj said:
I've been given a project which requires writing scripts that need to
be run on over 3000 servers. Only about 15% of them have python
installed on them. While all/most of them will have perl.

I used to work for a company with hundreds of development workstations
and build/test servers, different operating systems (add to the mixture
regular disk failures and regular hiring of new people). Everything was
controlled by pretty big perl scripts and people who maintained all the
tools found that using perl from distributions was a hassle because of
differences between perl versions and the need to install it if OS
doesn't have it. So they just built several (for different
OSes/archetectures) relocatable distributions of perl and put them on a
network drive. That turned out to be more reliable and more easy to
maintain.

You can do the same with python.
I'll try and do as much as possible in pexpect but am sure I'll have do
some significant perl. Any suggestions on what is the best way to get
upto speed on perl?

Forget about perl :)
 
M

Mirco Wahab

Hello vj
I'll try and do as much as possible in pexpect but am sure I'll have do
some significant perl. Any suggestions on what is the best way to get
upto speed on perl?

Perl is (imho) much more complex and
somehow more powerful than Python
(if you can handle it) - it has more
development iterations behind it plus
a large contibuting community - and
their bear's den (CPAN) -- which
will probably save your project some-
times from debris falling around you.

BUT! There is no problem in using
a subset of Perl (called Baby-Perl)
that allows you translating your
Perl Scripts to Python by omitting $$
and { }, replace 'sub' by 'def'
(plus some minor modifications).

There is a nice "comparison" on Python
and Perl available on the Web, which gave
me a good laugh for more than 30 seconds ;-))

http://www.adequacy.org/stories/2001.12.20.165434.32.html

(too bad - most responders didn't get the point of it)

Regards,

M.
 
M

Magnus Lycka

vj said:
I've been given a project which requires writing scripts that need to
be run on over 3000 servers. Only about 15% of them have python
installed on them. While all/most of them will have perl.

I'll try and do as much as possible in pexpect but am sure I'll have do
some significant perl. Any suggestions on what is the best way to get
upto speed on perl?

The thing that really bit me when I tried to go back to Perl after
years with Python was dereferencing. Completely obvious things in
Python, such as extracting an element from a list inside a dict in
another list felt like black magic. I actually gave up, but later I
realized that there is an entire chapter in Programming Perl about
the stumbling blocks with dereferencing in Perl.

I don't think people in this group :) will disagree if I claim that
Python software is much more maintainable and easier to develop and
debug than Perl scripts. That's probably relevant if they are to
run on thousands of servers.

I'd make a real effort to investigate if it's possible to either
install Python on all boxes or use something like cx_Freeze to make
executables out of the scripts.
 
S

Sion Arrowsmith

Magnus Lycka said:
The thing that really bit me when I tried to go back to Perl after
years with Python was dereferencing. Completely obvious things in
Python, such as extracting an element from a list inside a dict in
another list felt like black magic.

Not that long ago I had to make some enhancements to someone else's
Perl script which was handling that kind of data structure. I
stared and stared at a particularly long and messy dereference, and
eventually figured out what it was doing. I then wrote what the
equivalent Python would have been. Even forgiving the Perl's initial
"my", thanks to the line noise characters the Python was over 10%
shorter, as well as more readable. So much for the myth of verbosity.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top