in reply to Variable in a foreach loop
Having to know how many rows and columns there are in a multi-dimensioned array can become tedious. Unless strictly necessary you can avoid it having to code it into your program...
use strict; sub dataSetup { return ( [ qw|a b c d| ] , [ qw|a b c d| ] , [ qw|a b c d| ] ) ; } sub main { my @multi = dataSetup(); foreach my $row (@multi){ foreach(@$row){ print qq|$_\n|; } } } #---- &main;
Celebrate Intellectual Diversity
|
|---|