neilwatson has asked for the wisdom of the Perl Monks concerning the following question:
my %hash = ( keya => [a1, b1, [ qw(c1a, c1b) ] ], keyb => [a2, b2, [ qw(c2a, c2b) ] ], )
Now the tricky part. Trying to access it. I'm close but not quite there:
foreach my $key (sort keys %hash){ print @{$hash{$key}}[0]; #prints a1 for first hash print @{$hash{$key}}[1]; #prints b1 for first hash print @{$hash{$key}}[2]; #how do I access this list? }
How do I access the last array in each hash?
Neil Watson
watson-wilson.ca
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Complex data structure
by Zaxo (Archbishop) on Oct 16, 2003 at 01:11 UTC | |
|
Re: Complex data structure
by fglock (Vicar) on Oct 16, 2003 at 01:11 UTC | |
|
Re: Complex data structure
by The Mad Hatter (Priest) on Oct 16, 2003 at 01:08 UTC | |
by hardburn (Abbot) on Oct 16, 2003 at 14:31 UTC | |
|
Re: Complex data structure
by pg (Canon) on Oct 16, 2003 at 01:10 UTC | |
|
Re: Complex data structure
by neilwatson (Priest) on Oct 16, 2003 at 01:23 UTC |