in reply to Re: Re: Mind Bending Arrays
in thread Mind Bending Arrays

You should probably be using a hash instead.

my %hash; while (my ($filename, $number) = &get_both) { $hash{$filename} = $number; } my @sorted_files = sort { $hash{$a} <=> $hash{$b} } keys %hash;
If you really need to put this in an array (to keep track of the insertion order, for example), you could probably do it like this:
my @array; while (my ($filename, $number) = &get_both) { push(@array, [ $filename, $number ]); } my @sorted = sort { $a->[1] <=> $b->[1] } @array;