testing testing... perl question

Aidan Samuel aidan.samuel at gmail.com
Mon Aug 13 11:31:25 BST 2007


Hello everyone, I'm new here.

Is it ok to ask a perl question?

perl -e '@a = (1..5); print sort $a <=> $b, @a;'
012345

perl -e '@a = (1..5); print sort {$a <=> $b} @a;'
12345

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.

Thanks!

Aidan.


More information about the london.pm mailing list