in reply to Array of array
Instead of pushing the array as list context, I you push the reference of each array you can take the @arr2 separately easily
use strict; use warnings; use Data::Dumper; my @mainarr; my @arr1=qw(a b c d e); my @arr2=qw(f g h i j); my @arr3=qw(k l m n o); push(@mainarr,\@arr1); push(@mainarr,\@arr2); push(@mainarr,\@arr3); # print Dumper \@mainarr; my $index=0; foreach (@mainarr){ print @{$mainarr[$index]} if $index == 1; $index+=1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Array of array
by ig (Vicar) on Jun 04, 2009 at 08:40 UTC | |
by vinoth.ree (Monsignor) on Jun 04, 2009 at 09:16 UTC | |
by ig (Vicar) on Jun 04, 2009 at 10:08 UTC |