Perl has these tiny little functions that make me use it more for small, personal one-time use things. PHP has support for some of them but often it feels just wrong and not supposed to be there. My favourite example is unless() (should I even add those ()?). Perl has the most awesome function ever:
print 'Hello world.' unless $world eq 'Destroyed';
That all, in one line. PHP has (together with Javascript) a good but too long and confusing option for, the shorter version of if(), I use it all the time. It would look like this in PHP:
print ($world == 'Destroyed') ? '' : 'Hello world';
Ok, that's a pretty sweet function but it requires me to type too much special characters.
The second function I would like to talk about is ... well it has no name, it's just something you can do. In short, it is this:
($arrayOptionOne,$arrayOptionTwo) = @array;
That is the Perl version, PHP has this one too but they really had to add a specific named function for it:
list($arrayOptionOne,$arrayOptionTwo) = $array;
And then one of the functions I use all the time for things that involve editing files:
open(FileHandle,"<fileName");
print join("",<FileHandle>");
That's it! That's just it, we have read a complete file in two lines of code. The PHP version is horrifying here:
$fileHandle = fopen('fileName', 'r');
$data = fread($fileHandle, filesize('fileName'));
fclose($fileHandle);
print $data;
Now I hear some people say: what's wrong with file_get_contents() then? Nothing, except it doesn't allow you to change the mode parameters (you know: read, write, append, ..) which is quite useful.
After all, anything that I need to write quickly for a task is written in Perl, but in the end PHP is the most powerful language for websites so don't get all mad on me for not mentioning that before.