in reply to hash-value access via special constructed key

You could surely do something like that using Tie::Hash, but why not using a lookup function?
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}; }


holli, /regexed monk/

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
    very nice solution.....

    Luca