#untested! foreach $aref (@M) { foreach $element (@$aref) { print "$element "; } print "\n"; }