would be a little cleaner. The original code would return a sorted array AND leave you with a sorted @unsorted. This way, by dereferencing the array, it will just return a sorted array, and leave @unsorted alone.sub this { my @array = @{(shift)} ; my $keys = shift ; for my $key (@$keys) { @array = sort {$$a{$key} cmp $$b{$key}} @array; } return @array; }
In reply to RE: Re: Sort Array of Hashes based on Hash value
by sean
in thread Sort Array of Hashes based on Hash value
by raflach
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |