in reply to Array of array building
Perl doesn't have multi-dimensional arrays; it has arrays of references to arrays, so doing something like
will print a list of array references.print join("\n",@AoA); #where @AoA is an Array of Arrays
To manipulate individual elements, the sub-array has to be dereferenced, sort of like this:
my @AoA; my @subarray; @subarray = @{$AoA[$i]}; tr/A-Z/a-z/ foreach @subarray; $AoA[$i] = \@subarray;
Note that the above is not intended to be valid Perl code, that's why I said "sort of like this." Check perlref for an explanation guaranteed to be correct. And I think it's clear, too.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Array of array building
by jethro (Monsignor) on Oct 01, 2008 at 17:06 UTC | |
by wol (Hermit) on Oct 02, 2008 at 14:03 UTC | |
by swampyankee (Parson) on Oct 01, 2008 at 22:28 UTC |