>
>Adam Stern wrote:
>
>> Hi, I was wondering if anyone could tell me how to put a list of lists
>> into a hash array, and how do I access it. I know this is wrong, but it
>> conveys the idea:
>>
> > @arrayname{key} = ( [0,1,2,3,4],
>> [1,2,3,4,5],
>> [2,3,4,5,6],
>> [3,4,5,6,7],
> > [4,5,6,7,8]).
You can do nested data structures in Perl using references. (since
references are scalars, and hashes and arrays can only contain
scalars) The [] creates list-by-reference, so you have that part
right; you just need to make your containing list a list ref, and the
left side need correct hash syntax.
$hash{key} = [ [0,1,2,3,4],
[1,2,3,4,5],
[2,3,4,5,6] ];
$hash{key}->[0]->[0] is now zero. You can get and test using this syntax.
Since you are using references on the right side, you may want to
reference your hash just to make things consistent.
$hashref = \%hash;
$hashref->{key}->[0]->[0] (etc)
best
eric (SUNY-B, 1988)
--
------------------------------------------------------------------
Eric Fixler v:1-415/305-0565
[EMAIL PROTECTED]
------------------------------------------------------------------