in reply to stumped on a complex data structure

use strict; use warnings; my %HofA = ( 0 => [ '1;;;;;;;', ';;;;;;;;', ';;;;;;;;', ';;LINE;;SVC;LINE;ACCT;VIEW;', ], 1 => [ '1;;', ';;;', ';;;', ';LINE;;', ], 2 => [ '1;;;;;', ';;;;;;', ';;;LAST;;;', ';UPDT;SRCE;UPDT;UPDT;WORK;', ], ); my @out; for (sort {$a <=> $b} keys %HofA) { my $c; for (@{$HofA{$_}}) { $out[$c++] .= $_; } } print "$_\n" for (@out);
The advantage of this method is it only requires one pass through the hash, and it works with variable numbers of array slots. Note that I'm sorting on numerical comparison, since the example given had numerical keys and a straight sort would mess up the order.