thanksmy %hash1; $hash1{'1'} = 1; $hash1{'2'} = 1; $hash1{'3'} = 1; $hash1{'4'} = 1; $hash1{'5'} = 1; my %hash2; $hash2{'1'}{key} = 'a'; $hash2{'2'}{key} = 'b'; $hash2{'3'}{key} = 'a'; $hash2{'4'}{key} = 'a'; $hash2{'5'}{key} = 'b'; foreach my $key1 ( sort { $a <=> $b } keys %hash1 ) { print "key $key1 and $hash2{$key1}{key} \n"; } key 1 and a key 2 and b key 3 and a key 4 and a key 5 and b how to sort the above to get the below required output:- ------------------------------------------------------- key 1 and a key 3 and a key 4 and a key 2 and b key 5 and b
In reply to hash sort by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |