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,