I am trying to work with a hash of files, and the work should be done in a specific order. Most will say that the list can be sorted like this:
for my $k (sort keys %my_hash) { print "$k=>$my_hash{$k}, "; }
However, I need a non-alphabetical order, in fact, the keys begin with the word then _ , and they go from G to digits to L to any of M,P,R,T or D (for example, word_G.txt , word_2.txt , .. ., word_P.txt ). Is there a way to sort by custom?
source share