in reply to Specify sort method on the fly
What's wrong with the simple solution?
my @sorted; if ($joe eq "numbers") { @sorted = sort { $hoh{$a}->{value} <=> $hoh{$b}->{value} } keys %hoa; } else { @sorted = sort { $hoh{$a}->{value} cmp $hoh{$b}->{value} } keys %hoa } foreach $key ( @sorted ) { blah; }
|
|---|