SPUG: In over my head with hashes of arrays of arrays

Jeremy G. Kahn kahn at cpan.org
Fri Jul 22 16:36:41 PDT 2005

Hey Duane (*waves*):

The trick is to think object-y.  An array which has an array at each 
element is a 2-d array, or a Grid.

So if the value of each hash key is a reference to a Grid, you're okay, 

$myhash{evens} = [ [0,2,4], [4,6,8] ];
$myhash{odds} = [ [1,3,5], [7,9,11] ];

then you can access it as $myhash{$odds}->[0][0] .

cf `perldoc perlol`; `perldoc perldsc`, `perldoc perlref` and (probably 
what you'll want in the long run) `perldoc perlobj`.


Duane Blanchard wrote:

>Hi Spuggers,
>I'm working on a hairy data set for which I need a hash in which the
>values are arrays which each have as one of their elements an
>additional array. My assumption is that I will be OK using anonymous
>arrays, but before I stay up all night trying to figure out that my
>assumption is wrong, I thought I'd ask someone.
>Thanks, yet again,

More information about the spug-list mailing list