What is the best way to access one array within an array?De-reference it:
use strict; use warnings; use Data::Dumper; my @aoa = ([0..3], [10..12]); # array-of-arrays print Dumper(\@aoa); for my $aref (@aoa) { my @arr = @{ $aref }; # derefernce each array for (@arr) {print "$_\n"} # access each scalar value } __END__ $VAR1 = [ [ 0, 1, 2, 3 ], [ 10, 11, 12 ] ]; 0 1 2 3 10 11 12
What is the best way to manipulate (add, modify, delete) a scalar value within an array?Adding to left (push), adding to right (unshift), delete from left (shift), delete from right (pop), delete from middle (splice). See also perlfaq4, Data: Arrays.
In reply to Re: Array of array building
by toolic
in thread Array of array building
by JimEL
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |