in reply to array refernce as hash value
Do you think of something like this?
my %hash = ( key1 => [\@a1_ref, \@a2_ref], key2 => [\@a3_ref, \@a4_ref], );
If you want to use the a2_ref for instanze, $hash{key1}->[1] could be what you want.
Edit: As an example:
#!/usr/bin/perl use strict; use warnings; my @array1 = ( 1 .. 6 ); my @array2 = ( 7 .. 9 ); my @array3 = ( 'aa' .. 'af' ); my @array4 = ( 'b0' .. 'b9' ); my %hash = ( key1 => [\@array1, \@array2], key2 => [\@array3, \@array4], ); print "hoffentlich eine acht: ", $hash{key1}->[1]->[1], "\n";
It prints "hoffentlich eine acht: 8".
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: array refernce as hash value
by Anonymous Monk on Jul 22, 2009 at 10:28 UTC | |
by Anonymous Monk on Jul 22, 2009 at 10:29 UTC | |
by ashish.kvarma (Monk) on Jul 22, 2009 at 10:53 UTC | |
| |
by Crian (Curate) on Jul 22, 2009 at 10:41 UTC | |
by Anonymous Monk on Jul 22, 2009 at 10:46 UTC |
In Section
Seekers of Perl Wisdom