in reply to Re: Sort Array of Hashes based on Hash value
in thread Sort Array of Hashes based on Hash value
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: Re: Sort Array of Hashes based on Hash value
by BBQ (Curate) on Jun 07, 2000 at 09:22 UTC | |
|
RE: RE: Re: Sort Array of Hashes based on Hash value
by buzzcutbuddha (Chaplain) on Jun 07, 2000 at 15:45 UTC |