Skip to main content Skip to navigation

The wacky world of Perl

One of Perls specialisations is being able to write things so that their meaning is less than clear. Here are a few examples:

 

What Perl says What Perl means
$| = 1; Turn off output buffering
scalar(@a) The number of items in the array @a (Wouldn't size(@a) be clearer?)
Moose does not export its sugar to the 'main' package. Isn't it obvious!

$$s[$i]

The contents of the $i'th entry in the array @s. Note that the three $'s mean completely different things. The first means 'the contents of' and the second means 'the scalar value from the array' (in this case the array @a), and the third is simply identifies i as a variable.
   
   

There's also some interesting psychology associated with Perl. In the following Blog when it was thought there was a windows problem there is a sarcastic 'don't you just love windows' When it turns out to be a Perl problem that can only be solved by uninstalling everything and reinstalling Perl 5.8 from scratch there is no comment whatsoever. If that had been windows there would have been a longanti-windows tirade

http://support.hamweather.com/viewtopic.php?t=6598

Another example of someone trying to work through the inconsistencies of Perl and its documentation in order to get some code to work. When it does, they still don't know exactly what it was that they did that finally fixed the problem.

http://contourline.wordpress.com/2010/01/27/better-post-on-moosexdeclare-method-signatures/