in reply to table sorting of hashes

The idea is simple:

First, build a two dimensional array -
original array: a b c d e f g h i j k l m ... 2-d array: a b c d e f g h ...

When you print your data:
for $x (0..4) { for $y (0..4) { print $temp_array[$y][$x], "\t"; } print "\n"; }

Translate this into perl and you get your simple program.