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;
Perl Best Practices recommends using brackets when conjoining sigils ... @{ $ref } ... which I agree with when the expression is at all complicated. When it is as simple as in this case, however, I think it's straightforward enough -> The data stored in $ref is really an array, so please iterate over the elements.
As Occam said: Entia non sunt multiplicanda praeter necessitatem.
|