Sort-MultipleFields
view release on metacpan or search on metacpan
lib/Sort/MultipleFields.pm view on Meta::CPAN
=back
Really old versions
of perl might require that you instead pass the sort spec as an
anonymous subroutine.
mfsort sub { ... }, @list
=cut
sub mfsort(&@) {
my $spec = shift;
my @records = @_;
@records = @{$records[0]} if(reftype($records[0]) eq 'ARRAY');
(grep { reftype($_) ne 'HASH' } @records) &&
die(__PACKAGE__."::mfsort: Can only sort hash-refs\n");
my $sortsub = mfsortmaker($spec);
@records = sort { $sortsub->($a, $b) } @records;
return wantarray() ? @records : \@records;
}
( run in 0.311 second using v1.01-cache-2.11-cpan-49f99fa48dc )