you should have@sortdata = sort { $a <=> $b } (@data);
or even simply@sortdata = sort { $a cmp $b } (@data);
The reason is that <=> compares two values numerically whereas cmp compares them alphabetically. This is the default behavior for sort, though.@sortdata = sort @data;
In reply to Re: Sorting data problem
by Errto
in thread Sorting data problem
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |