Clear questions and runnable code
get the best and fastest answer
Re^3: Is Perl a good career move?by thinker (Parson)
|on May 24, 2005 at 12:50 UTC||Need Help??|
You make some excellent points about PHP, (and having spent much of the last 2 years as a PHP programmer, I agree with many of your points). In particular the namespace issue is a killer (although using OO techniques you can avoid the problem to a degree). You have also made some errors in your comments.
>>> Heck, it doesn't even have anonymous functions.
Yes it does.
>>> That's another thing: how will you be rewriting that hash of coderefs? A hash of strings that are evaled at runtime?
>>> Also, don't think $foo = bar() || $baz does the same in PHP. In PHP, you end up with true or false. So you must write it in two separate expressions.
I'm not sure if you could consider that as two separate expressions, but it seems a concise enough idiom for me.
While PHP does not have closures, I have used static variables in functions to emulate some of the behaviours I have used closures for in Perl.
Perl remains, by far, my language of choice, but I thought it would only be fair to point these things out