in reply to Coercing an array into a hash
A third way,
By checking for existence, the hash does not keep growing new undefined keys as possibles are tried. That is not a problem with the others since each invocation gets a new hash with them.{ my $remap = { qw( THIS THAT BLACK WHITE TALL SHORT ) }; sub remap_closure { exists $remap->{ $_[0] } ? $remap->{ $_[0] } : undef; } }
After Compline,
Zaxo
|
|---|