testing testing... perl question
Frank v Waveren
fvw.london.pm at var.cx
Mon Aug 13 12:33:43 BST 2007
On Mon, Aug 13, 2007 at 11:31:25AM +0100, Aidan Samuel wrote:
> perl -e '@a = (1..5); print sort $a <=> $b, @a;'
> When using map and grep I tend to leave off the curly braces and just
> use a comma, but if I try this with sort, I get these odd results.
grep and map take an expression or a block as their first argument,
whereas sort takes a block or subname.
To prevent nasty operator precedence surprises, you're best off using
a block instead of an expression, usually.
More information about the london.pm