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

Discussion in 'Python' started by vj, Mar 24, 2006.

  1. vj

    vj Guest

    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?
     
    vj, Mar 24, 2006
    #1
    1. Advertisements

  2. vj

    Jorge Godoy Guest

    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 <>

    "Quidquid latine dictum sit, altum sonatur."
    - Qualquer coisa dita em latim soa profundo.
    - Anything said in Latin sounds smart.
     
    Jorge Godoy, Mar 24, 2006
    #2
    1. Advertisements

  3. vj

    gene tani Guest

    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)
     
    gene tani, Mar 24, 2006
    #3
  4. vj

    Paddy Guest

    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.
     
    Paddy, Mar 24, 2006
    #4
  5. 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.
     
    john_sips_tea, Mar 27, 2006
    #5
  6. vj

    Serge Orlov Guest

    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.
    Forget about perl :)
     
    Serge Orlov, Mar 27, 2006
    #6
  7. vj

    Mirco Wahab Guest

    Hello vj
    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.
     
    Mirco Wahab, Mar 27, 2006
    #7
  8. vj

    Magnus Lycka Guest

    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.
     
    Magnus Lycka, Mar 28, 2006
    #8
  9. 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.
     
    Sion Arrowsmith, Mar 28, 2006
    #9
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.