Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

As a PHP developer thinking of making Perl a secondary strong suit, what do I need to know?

Tags:

php

perl

I consider myself quite fluent in PHP and am rather familiar with nearly all of the important aspects and uses, as well as its pratfalls. This in mind, I think the major problem in taking on Perl is going to be with the syntax. Aside from this (a minor hindrance, really, as I'm rather sold on the fact that Perl's is far more readable), what are some key differences you think I should make myself aware of prior to taking on the language?

like image 927
Hexagon Theory Avatar asked Jan 27 '09 03:01

Hexagon Theory


3 Answers

some different things worth a read about:

  • packages
  • lexical scopes
  • regular expression syntax
  • hashes, arrays and lists (all the same in PHP, all different in Perl)
  • CPAN
like image 120
Cal Avatar answered Nov 10 '22 01:11

Cal


After you learn the basics of Perl, I highly recommend the book "Perl Best Practices" by Damian Conway.

It really changes your writing style, and the way you think about programming, and in particular, makes your Perl programs much more readable, and maintainable.

like image 20
Tom Feiner Avatar answered Nov 10 '22 00:11

Tom Feiner


I had been using Perl for a very long time before doing any PHP, and I found the transition fairly easy.

The syntax is very similar between PHP and Perl. Obviously there are differences and you have to learn a new set of libraries (CPAN has modules for most uses, so before you implement any new tools have a look at CPAN).

Regexs are less verbose and imo a little easier to use in Perl. On the other hand classes in PHP looks a more like what you would expect if you know other OO languages. To me OO in Perl seems a little tacked on.

like image 24
Brian Rasmussen Avatar answered Nov 09 '22 23:11

Brian Rasmussen