http://www.perlmonks.org?node_id=155964

ajt has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

A friend of mine asked how and where to learn Perl. I have often suggested that Perl is a better solution to some of his problem than c/c++ or Java, but he normally retorts that their customers demand c/c++ or Java solutions so he has managed to avoid learning Perl to date...

His company has recently secured a new customer, and they use Interwoven CMS on Unix, and though the interface to the web is J2EE, a lot of the back end in Perl, and he needs to get up to speed on it very quickly.

Unlike myself he is actually professionally trained, and has a decent chunk of experience with c and c++, and a smattering of Java and shell (Korn I gather). He works with Solaris and NT/2K, and has Linux and 2K systems at home to play with too.

As I often say how good Perl is, and I worked in the CMS sector for some time, he has naturally asked me where to start. However I've never actually trained anyone to use Perl, and while I know the basics I still think of myself as only a keen amateur.

I told him where to look for source code and binaries, that's easy enough, and to have a look at some of the O'Reilly books, but I'm not sure what the best way to learn quickly is.

So given that my friends has many years c/c++ experience, and has easy access to Unix, Linux and NT/2K systems, and some budget - I think they may have enough money for books and maybe a training couses, what's the best advice:

I did a search on Super Search but got rather a lot of hits, none quite right, "Learn" is a common word. Well, I'm sure many are useful, but there was so many other off topic matches...

As ever, thanks in advance.

Replies are listed 'Best First'.
Re: How To Learn Perl From Scratch
by cjf (Parson) on Apr 02, 2002 at 10:03 UTC

    For someone who already has extensive programming experience I recommend picking up a copy of Programming Perl, reading it cover to cover (pay special attention to the Security chapter) writing out examples of concepts along the way. After that write a couple small practice projects and then he should be ready to get started.

    Depending on how fast a reader he is, this may take a couple weeks, but it's important not to rush it too much or he could end up with some very poor quality (and dangerous) code.

    Update: other nodes that may be of use:

    Another Update: As for sites to look at Ovid's CGI Course is good. I usually make a point of telling people not to go looking for other online tutorials because most of them encourage such bad practices.

      Not wanting to rehash anything already written, another good book is "Perl Black Book" ISBN# 1-57610-465-6. It is a good book but kind of duplicates info out of the Programming Perl book by OReilly but explains some stuff better.
Re: How To Learn Perl From Scratch
by mirod (Canon) on Apr 02, 2002 at 10:41 UTC

    I had about the same background as your friend (C + shell/awk + many others during my CS studies). When I first started using it I thought that Perl felt very, _very_ natural. It is really easy to write Perl that looks a bit like C, and thinks like using foreach instead of the clumsy C loops and pepperring the code with regexps are a welcome simplification.

    The things that I found the most difficult to understand: map, some tricky (and non-standard) regexps features like lookahead/lookbehind, the difference between scalar and list context. It also took me a while to get used to $_.

    Overall your friend should have no problem getting into Perl itself. Then it really depends on the quality of the existing code he has to work with... Getting the authors, if they are still with the customer, to explain the design of their code and their coding style would certainly be of great help.

Re: How To Learn Perl From Scratch
by Biker (Priest) on Apr 02, 2002 at 10:39 UTC

    Below is true in Switzerland and neighbouring France, but I believe it's true in large parts of the world.

    There are many proffesional training courses for Perl, but those I've seen have all been beginners courses. If your friend is already skilled in C, C++, etc. it is probably easier for him to pick up Learing Perl. He will learn more and quicker from reading the book than spending three days learning the basics of Perl in a commercial training (in this part of Europe).

    Since Perl comes very much from the UNIX world, there is one thing that directly comes to mind: Read The Fine Manual.

    My personal experience is that Perl is a language you have to practice to learn. Of course, exchanging ideas and experiences with other Perl programmers (Perl Monks?) helps a lot. But reading, trying, practicing are my keywords.


    Everything went worng, just as foreseen.

Perl Training Australia course-notes
by pjf (Curate) on Apr 02, 2002 at 13:16 UTC
    I agree with cjf, if you already have programming experience, then going straight to the Camel is certainly worthwhile.

    As for on-line help, try checking out the notes at Perl Training Australia. These course notes are professionally developed, free to use, and generally a great start to Perl. They also make extensive references to the camel and other books, so they're a great companion text for when the full camel seems a bit daunting.

    I'll admit a bit of a bias here, since my name is on all the notes and I teach and maintain them for a living. :)

    The introduction and intermediate courses should provide a good grounding in all the basic concepts.

    All the best,

    Paul Fenwick
    Perl Training Australia

Re: How To Learn Perl From Scratch
by demerphq (Chancellor) on Apr 02, 2002 at 13:35 UTC
    Considering the experience level of your friend I would suggest Mastering Algorithms With Perl and maybe one other book Learning Perl or Advanced Perl in addition to a short lesson on the use of perldoc. I suggest this because given his exposure to standard algorithms through his CS experience seeing the perl equivelents would probably be the most comfortable way to learn perl idiom without being on completely boring subjects (ie "this is an if statement...".)

    Personally I have always found one of the easiest ways to get exposed to a new language is to write something like a bubble sort, or binary tree implementation in the new language. Since I am familiar with how these algorithms work I need not worry that my issues are due to conceptual problems but rather to simple lack of exposure to the correct syntax.

    Oh and this might sound heretical to some of the *nix people out there but you could do worse than simply downloading the full set of perldocs in html form from ActiveStates ppm server and giving him a bit of a walkthrough of what is in which. Frankly id be suprised if after spending a day or two working through PerlToot PerlTootC and PerlBoot (with a touch of PerlSyn PerlDat PerlOpentut Perlre thrown in) with a print out of PerlVar and PerlOp and PerlFunc next to him that he didnt have enough for him to make his own decision as to what books to actually _buy_.

    Seriously, I cant recommend PerlToot PerlBoot and PerlTootC enough. Since I had already had a good exposure to OO ideas these three documents were enough to make me feel comfortable enough in perl that I didnt end up buying books on the subject till long after (although the one I most appreciate on a regular basis is Mastering Algorithms...) I mean they cover everything from Packages, Subrotuines, Inheiretance, Polymorphism, Closures, AUTOLOAD, basic datatypes, regular expressions.....

    UpdateThe name of the activestate HTML bundle of the standard perldocs is: ActivePerl-HTML

    Yves / DeMerphq
    ---
    Writing a good benchmark isnt as easy as it might look.

        Heh, and lets not forget those essential pstools....

        Yves / DeMerphq
        ---
        Writing a good benchmark isnt as easy as it might look.

Re: How To Learn Perl From Scratch
by strat (Canon) on Apr 02, 2002 at 12:13 UTC
    For the basics, he could also have a look at Robert's Perl Tutorial, which I think is rather good for the basics. Programming Perl and the Perl-Cookbook may be very good books for him (both O'Reilly).

    Best regards,
    perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"

Re: How To Learn Perl From Scratch
by DigitalKitty (Parson) on Apr 02, 2002 at 14:04 UTC
    Hi.

    If someone is an experienced programmer, they could easily learn the perl basics ( and some intermediate material ) with Learning Perl 3rd edition. It has several advantages over the second edition ( better style, pace of instruction, exercises, etc. ). I am reading it at the moment and every chapt. is very good ( I'm currently at 6 ). If they find it too 'basic', I would suggest either Programming Perl 3rd. edition and/or Professional Perl by Wrox press.

    Thanks,

    -DK
Re: How To Learn Perl From Scratch
by dreadpiratepeter (Priest) on Apr 02, 2002 at 15:20 UTC
    A side note. Tell him to consider the Programming Perl and other books recommended here as the right way to do perl, not what he sees in the Interwoven code. I've worked with Interwoven in the past and the code is very spotty in parts. A friend of mine was in the same boat as your friend, and I had to correct a number of bad habits he was picking up from the Interwoven code, which if I recall correctly is production code that does not use strict, warnings, or taint. Scary.
    Also, if I recall correctly, Interwoven uses their own version of perl called iwperl that is built off an older version of perl. Be careful.

    -pete
    "I am Jack's utter lack of disbelief"
Re: How To Learn Perl From Scratch
by teikweidi (Novice) on Apr 02, 2002 at 14:53 UTC
    Books Learning Perl (basics, skim this) Effective Perl Programming (read this) How to Program Perl (Deitel & Deitel)-> http://vig.prenhall.com/catalog/academic/product/1,4096,0130284181,00.html This last (Deitel)reference has disk tutorials included, great for interactive learning from the ground up, a good supplement to Learning Perl.
Re: How To Learn Perl From Scratch
by Zaxo (Archbishop) on Apr 02, 2002 at 16:44 UTC

    It's the community that makes the difference. Suggest that your friend become a Perl Monk and check out London.pm. That will help prevent damage from badly written examples he may need to work with.

    IMO Programming Perl is the right book for an experienced programmer.

    After Compline,
    Zaxo

Re: How To Learn Perl From Scratch
by pizza_milkshake (Monk) on Apr 02, 2002 at 14:00 UTC
    Tell him to go out and read all the O'Reilly Perl books and then to play a few rounds of perl golf :)

    perl -MLWP::Simple -e'getprint "http://parseerror.com/p"' |less
Re: How To Learn Perl From Scratch
by dws (Chancellor) on Apr 02, 2002 at 19:47 UTC
    A friend of mine asked how and where to learn Perl.

    Like your friend, I came at Perl with several other languages (and years of experience) in my bag. What worked for me was to find real problems that I wanted to solve, then study how someone else solved them in Perl. At the time, studying merlyn's columns in the now-defunct Web Techniques magazine. Fortunately, his columns are all on-line here. I recommend keeping a copy of the Camel within reach during study.

    And along the way, I ingested several Perl books, including many mentioned above, and merlyn's Effective Perl Programming, which helped me through the Intermediate transition.

    That, and practice, practice, practice.

Re: How To Learn Perl From Scratch
by bastard (Hermit) on Apr 02, 2002 at 19:00 UTC
    Since it hasn't been mentioned yet, make sure he knows about CPAN. It can save him from re-inventing alot of wheels and contains many examples of perl code (subs, oo, etc...) throughout the documentation for the modules.
Re: How To Learn Perl From Scratch
by klsh (Initiate) on Apr 02, 2002 at 19:56 UTC
Re: How To Learn Perl From Scratch
by Anonymous Monk on Apr 02, 2002 at 19:30 UTC
    Perhaps if he is experienced he could start with Larry Wall's Programming Perl many have said that the third edition eliminates the need for Learning Perl (although I personally have used both to learn). Although he may wish to consult the online docs when he comes to unicode as I believe what is in Learning Perl I is not entirely up to date.