in reply to hash-value access via special constructed key
my $hash = { a1 => { a2 => 'Hi' } }; my @key = qw {a1 a2}; print "Hash-value is ", lookup($hash, @key), "\n"; sub lookup { my $hash = shift; my $key = shift; return @_ ? lookup($hash->{$key}, @_) : $hash->{$key}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: hash-value access via special constructed key
by ikegami (Patriarch) on Mar 07, 2006 at 15:22 UTC | |
|
Re^2: hash-value access via special constructed key
by jeanluca (Deacon) on Mar 07, 2006 at 13:11 UTC |