[PLUG] Perl 3D array - printing all values
Paul Heinlein
heinlein at madboa.com
Wed Oct 22 13:26:01 UTC 2003
On Wed, 22 Oct 2003, Matt Alexander wrote:
> This should be an easy one for you Perl gurus... ;-)
>
> I have a 3 dimensional array in Perl...
>
> $myarray[$val1][$val2][$val3]
>
> I would like to print every value in the array.
foreach my $x ( @myarray ) {
foreach my $y ( @{$x} ) {
foreach my $z ( @{$y} ) {
print $myarray[$x][$y][$z], "\n";
}
}
}
--Paul Heinlein <heinlein at madboa.com>
More information about the PLUG
mailing list