in reply to Declaring my variables in sort function?
sort uses the "global" variables $a and $b as comparing algrothm for the sort; you can't use other variables instead
if you try to use my-variables instead, you are useing other variables and it won't work
sort is the reason why $a and $b aren't checked by use strict; so IMHO it's a good idea to reserve these variables to sort
use strict; my @home = (1, 2, 23, 10, 9); print map { "$_\n" } sort { $a <=> $b } @home;
Best regards,
perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"
|
|---|