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";
In reply to auto-magical flipped hashes by gregorovius
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |