Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: From PHP to Perl - Should I, and how?

by webfiend (Vicar)
on Mar 09, 2009 at 15:42 UTC ( [id://749323] : note . print w/replies, xml ) Need Help??

in reply to From PHP to Perl - Should I, and how?

Yes, you should learn Perl, for the same reason you should add any language to your toolkit. It gets easier to clearly express your intent in code as you learn the idioms common across different languages. You also get an idea for what concepts are easier to express in a particular language, which will give you whole new ideas for how to organize a project. I initially learned Perl because of how much easier it was to express regular expressions compared to PHP, and those regular expressions changed how I looked at text manipulation for a very long time indeed. Once I got the hang for coding in Perl, everything including GUI and Web development became much easier and definitely more powerful for me than in PHP. Your mileage may vary, of course.

You don't lose anything by using Perl instead of PHP, but fewer libraries are effectively built-in to the language. Database handling and a bewildering assortment of Web-specific features are available via external libraries on CPAN.

Now on to your specific questions:

  1. It depends on the modules and how much you want to know right now. While you're getting started, use <Module> is all you need to know. Later you'll mess with export lists and so forth. Generally speaking, installation and updating of modules is handled via the cpan shell. cpan install <module> and cpan upgrade will do all of the dirty work while you sip your coffee and answer emails. ppm is available if you are using ActivePerl, and it follows a similar usage pattern.
  2. Look at Tutorials, and in particular Including files. Also check out perlmod when you're curious to look at the gory details.
  3. Sure, but they tend to vary from one user to the next. My gotcha was learning that I didn't have to learn every bit of Perl to start writing useful code. Start simple and improve your code with new idioms as you learn them. Also, the greatest way to answer most questions is TIAS: Try It And See. Like PHP, Perl encourages experimentation.

Go ahead and learn Perl. It's always worth your time to expand your knowledge.