sub process { my ( $ref ) = @_; for my $row ( @$ref ) { for my $elem( @$row ) { print "'$elem' "; } print "\n"; } } my @data = ( [ qw( a b c d e) ], [ qw( L M N ) ], [ qw( 3 1 4 1 5 9 2 6 ) ], ); process \@data;