sub create_sorter { my $contents = shift; return sub { # sort however you want here $contents{$a}{FOO} cmp $contents{$b}{FOO} }; } my $by_sort_method = create_sorter \%contents; foreach my $id (sort $by_sort_method keys %contents) { ... }
In reply to Re: Re: Scoping issue when sorting with subroutines
by mdillon
in thread Scoping issue when sorting with subroutines
by Dave05
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |