my @sorted_keys = sort { $country_names{$a} cmp $country_names{$b} } k +eys %country_names;
Considering that in the end you would have sorted VALUES not the keys, above array variable name is rather misleading.
Correction. Afer grep's reply below, I saw that what was misleading was my claim made above. The array name was reasonable; it was my fault for forgetting that sort sorted the LIST based on result of BLOCK.
In reply to Re^2: hash sorting/alphabetization issue : country postal codes
by parv
in thread hash sorting/alphabetization issue : country postal codes
by hmbscully
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |