>>>>> "Ed" == Ed Peschko <epeschko@animas.tcinc.com> writes:
Ed> Yes.. but unfortunately, I was under the (mis) understanding that this didn't
Ed> occur.. and was using a multi-dimensional hash to hold things such as a 'before
Ed> and after' snapshot of columns in a table: ie:
Ahh... so there's your problem. You think that what you have here is
a multidimensional hash. The syntax even tricks you into thinking
that you have that. But you don't. Perl doesn't have either
multidimensional hashes or lists of lists. It has hashes of
references to hashes, and lists of references to lists, that can be
used to *pretend* that you have those other things, but if you push
the pretense too far, you can see that it breaks.
This is why I can't teach:
$a[35][12]
in day two of my Learning Perl class, even when people say "so, are
there multidimensional arrays?". My answer to this is "*no*, but wait
until we get all comfortable with the fact that that there isn't and
then I'll show you (bit by bit) how to use pointers to pretend that
there are."
Because remember, this is only a shorthand for:
$a[35]->[12]
and that arrow cannot really be eliminated. $a[35] is a real thing:
it's a ref to an anon-list, and we're looking at element index 12 of
that list. So to know what this is doing, you have to bring in all of
the ref technology and understanding, building it up slowly from "what
does \@anarray mean?".
Sorry for going off like this, but I think we just can't hide behind
the "perl has multidim lists and hashes now!" banner. It doesn't have
it, but it has things that can pretend, as long as you know it's just
pretend.
I'm also struggling with these very issues for the appropriate section
of the new camel book. So I'm in the midst of this stuff.
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="
http://www.teleport.com/~merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me