gregorovius has asked for the wisdom of the Perl Monks concerning the following question:
Wouldn't it be nice if perl provided 'FLIPPED' as a magical hash key to automatically make available the flipped contents of a hash? Is there a simpler way to do this?%h = (key1 => 'content1', key2 => 'content2'); $h{FLIPPED} = { map {$h{$_}, $_ } (keys %h) }; print "$h{key1} : $h{FLIPPED}{content1}\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: auto-magical flipped hashes
by btrott (Parson) on Jul 12, 2000 at 22:39 UTC | |
RE: auto-magical flipped hashes
by cariaso (Novice) on Jul 13, 2000 at 00:18 UTC | |
by perlmonkey (Hermit) on Jul 13, 2000 at 07:56 UTC |
Back to
Seekers of Perl Wisdom