in reply to How to Sort a Hash According to the Keys in the Hash

You can't retrieve the order of the keys from a normal hash. It's too late - the hash is already unsorted.

However, you can use Tie::IxHash:

use Tie::IxHash; tie my %h, 'Tie::IxHash'; %h = ( Sports => ["Soccer","UltimateFrisbee","Basketball"], Books => ["Cannery Row", "Animal Farm", "East of Eden"], Places => ["BigSur","Zion", "CrateLake"] ); print "$_\n" for keys %h;
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: How to Sort a Hash According to the Keys in the Hash
by ishootperls (Novice) on Dec 02, 2015 at 19:15 UTC

    Outstanding !! Wasn't aware of such module. Thanks choroba !!

    "An incendiary Perl will solve that problem" :-) - myself