in reply to looping over multidimensional arrays

for my $a1 (@x) { for my $a2 (@$a1) { for my $a3 (@$a2) { ... # hope you get the pattern by now } } }

For covering arbitrary depth of nesting you could apply a recursive function (a so called "walker")

If the elements are other than array_refs you might want to add cases after testing ref $aX.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice