Translation guide for Perl and PHP  MAR 17 2004

Translation guide for Perl and PHP. Would be great if this included several other popular languages.

There are 3 reader comments

Laurie27 17 200412:27PM

This is written very much from a Perl programmer's perspective -- it lists things you do in perl, and how you would do the exact equivalent in PHP. As a result, it ends up making PHP look rather long and convoluted compared to Perl, when in my experience the opposite is the case (although PHP lacks some of Perl's power).

For instance, it shows the PHP translation of the Perl idiom "while (list($key,$value) = each($h))" when in fact PHP's equivalent is the much simpler "foreach($h as $key => $value)".

As another example: it uses the Perl CGI library to generate HTML, which makes it look simpler -- and it is, if all you want to do is generate very simple HTML widgets. But it ignores the flexibility of being able to include big wodges of HTML in your PHP without needing to quote anything, which is one of the things that makes PHP so nice for writing web apps quickly.

leonard59 17 2004 1:59PM

PLEAC is an collaborative effort to translate the Perl Cookbook across various languages (python and ruby are about half done).

jimbishop33 18 2004 5:33PM

There is also Doug Bagley's Great Computer Language Shootout that not only gives sample code for each test, but also tells you how it compares in memory and CPU usage.

This thread is closed to new comments. Thanks to everyone who responded.

this is

   Front page
   About + contact
   Site archives

You can follow on Twitter, Facebook, Tumblr, Feedly, or RSS.

Ad from The Deck

We Work Remotely


Hosting provided by