Advertise here with Carbon Ads

This site is made possible by member support. โค๏ธ

Big thanks to Arcustech for hosting the site and offering amazing tech support.

When you buy through links on kottke.org, I may earn an affiliate commission. Thanks for supporting the site!

kottke.org. home of fine hypertext products since 1998.

๐Ÿ”  ๐Ÿ’€  ๐Ÿ“ธ  ๐Ÿ˜ญ  ๐Ÿ•ณ๏ธ  ๐Ÿค   ๐ŸŽฌ  ๐Ÿฅ”

Translation guide for Perl and PHP

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

Reader comments

LaurieMar 17, 2004 at 12: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.

leonardMar 17, 2004 at 1:59PM

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

jimbishopMar 18, 2004 at 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.