in reply to Re: Anonymous Reference???
in thread Anonymous Reference???
"An array can ONLY contain scalar elements."
Strictly speaking, you were not 100% correct as the following code is valid:
use Data::Dumper; use strict; use warnings; my @a = ((1,2,3), (4,5,6)); print $a[3];
So array can contain array. However Perl "flattens" the inner arrays, and does not remember the boundary information. This made it impossible to use this way to represent multi-dimentional array, and the array of array ref comes to rescue.
Update: Yes, the example sk given in his reply demos my point better.
However I disagree with his conclusion. I don't think either side is really wrong, and it really depends on whether you look at it from a syntax point of view (my view) or an internal represent view.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Anonymous Reference???
by chromatic (Archbishop) on Sep 12, 2005 at 04:24 UTC | |
by sk (Curate) on Sep 12, 2005 at 04:38 UTC | |
|
Re^3: Anonymous Reference???
by halley (Prior) on Sep 12, 2005 at 12:31 UTC |