in reply to Re: hash sortin thread hash sort
foreach my $key1 ( sort { $a <=> $b } keys %hash1 #main loop [download]
Anyway to sort without rewriting main loop ?
No. You must interpolate the code given to you into the loop argument:
foreach my $key1 ( sort { $hash2{$a}{key} cmp $hash2{$b}{key} || $a <=> $b } keys %hash1 ) { [download]
The loop body can remain as it is, I guess.