rsFalse has asked for the wisdom of the Perl Monks concerning the following question:
Why doesn't sort? :/
#!usr/bin/perl my $a = 1; %hash = map { $_ , undef } 0 .. 3; @h = sort {$a <=> $b} keys %hash; print "@h\n"; __END__ 0 3 2 1
@h = sort {$a <=> $b} @arr = keys %hash; # doesn't sort @h = sort {$a <=> $b} 0 .. 3; # do sort @h = sort {$a <=> $b} @arr = 0 .. 3; # do sort
|
---|
Back to
Seekers of Perl Wisdom