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.

kottke.org

Front page
About + contact
Site archives

Subscribe

Follow kottke.org on Twitter

Follow kottke.org on Tumblr

Like kottke.org on Facebook

Subscribe to the RSS feed

Advertisement

Ads by The Deck

Support kottke.org shop at Amazon

And more at Amazon.com

Looking for work?

More at We Work Remotely

Kottke @ Quarterly

Subscribe to Quarterly and get a real-life mailing from Jason every three months.

 

Enginehosting

Hosting provided EngineHosting