in reply to sorting hash in a non alpabellical order

A hash has no order.

But maybe you want to output the elements of a hash in a particular order. Then you can use the following approach with a "hash slice" for example:

my @columns= qw(A R N D C Q E G H I L K M F P S T W Y V B Z X); my %hash= ...; print "@columns\n"; print "@hash{ @columns }\n";

The alternative approach is to simply use a loop over @columns.

Replies are listed 'Best First'.
Re^2: sorting hash in a non alpabellical order
by madM (Beadle) on Jan 13, 2014 at 11:45 UTC
    thank you! this helps me a lot :)