Big Fish
Tim Burton
It took me awhile to warm to this movie, but I ended up enjoying it.
Not a great movie, not one I’ll watch again for some time, but with a sweet, funny and thoughtful story line. And great imagination.
Actually, this is a movie that works better as a preview – its got some great, three-second-long shots that would translate well to previews/commercials and so on.
There’s a lot of iffy areas that Perl catches flack for – loosely typed variables, overuse of hashes, the utter incomprehensibility of some excellent code (such as a great regex to extract data – looks like a punctuation-fest).
However, my biggest gripe – and maybe I’m missing something – is the lack of a built in trim() function.
Why not??
While I understand that you can use a regex like I have above, a trim function is something, to me, that should be part of every language.
Especially in these days of XML and Web-based apps, the spaces can matter.
So you want to trim stuff before it goes into the database.
Ditto when it comes out.
But that’s me.
=======
PHP
=======
$myVar = ” Foo Bar “;
$myVar = trim($myVar); // now “Foo Bar”; full trim
$myVar = ltrim($myVar); // now “Foo Bar “; left trim
$myVar = rtrim($myVar); // now ” Foo Bar”; right trim
=======
T-SQL (MS SQL Server)
=======
— No full trim (makes me nuts, also!);
— nest left and right trims
select ltrim(rtrim(‘ Foo Bar ‘)) as myVar;
— will return “Foo Bar” for myVar
======
Perl
======
$myVar = ” Foo Bar “;
$myVar =~ s/^\s+|\s+$/; # returns “Foo Bar”
There is an int() function in Perl – that returns a string as an integer. You could write a simple regex for this, as well, but there is the more useful – and expected – int function (parseInt() in JavaScript, I believe – in database languages you often have to CAST the string).
So why not a freakin’ trim function?!?
I still like Perl in spite of it.