Leave a comment

skington November 13 2013, 14:45:44 UTC
All perl man pages are online these days, if they weren't 10+ years ago, and in any case stackoverflow.com is there to answer your questions.

That "weird difference" between arrays and hashes is a distinction that every single other programming language implements. PHP is unusual in ignoring it and lumping arrays and hashes into a hideous conglomeration.

As for $_ and @_, consider it the equivalent of "it" and "them" - they're useful shorthands, but if you find yourself wondering "What's in $_ now? Could something have stomped on it?" then the answer is that you should have stuck it in a more permanent variable if you cared about it. It's a trade-off, sure, but a handy one.

mod_perl was always tricky, sure, but these days there are much more interesting ways of running Perl code in a webserver - see e.g. Plack, Starman, Dancer / Mojolicious / Starman. Sure, PHP does the basic simple stuff for you out of the box, but if you want to change anything you need to recompile Apache - something that's impossible in a shared hosting environment. So, again, it's a trade-off between "the simple stuff works fine" and "but I can't do anything more interesting".

Reply

meowpurrr November 13 2013, 15:35:59 UTC
The thing PHP has had for as long as I've used it is a single site you can type a function name into, and it will redirect you to the page dedicated to explaining that function. A lot of Perl teaching examples also relied on grabbing things from CPAN, where again it wasn't clear how to usefully use a new module without having to read and understand the module's entire code. (Although PEAR modules aren't hugely better in that regard, but there is usually some phpdocumenter web output to be found.)
Anyway, unless I change jobs I can't see me learning Perl these days.

I love PHP's array handling. :)

The problem with $_ was that lots of example code to learn from, or code written by other people you might want to crib from, used it all over the place, making it require telepathy (or attempting and most likely failing at refactor-y injecting of other variable names) to decipher as a newbie who didn't know what things returned.

I've never in >10 years needed to (re)compile Apache or PHP. I've occasionally compiled a PECL module to hook into the precompiled PHP, but a lot of those are also available precompiled. Then again, I don't use shared hosting.

Reply


Leave a comment

Up