It needs a real hash to work on (possibly there is a more technical description of this), but the map just produces a list of values, not a hash.
You can do it all in one line though:
use 5.010; sub uniq { return keys %{ {map { $_ => 1 } @_} }; } say for uniq qw/ foo bar foo baz bip foo /;
Good Day,
Dean
In reply to Re: Why does 'keys' need a named hash?
by duelafn
in thread Why does ‘keys’ need a named hash?
by ankitpati
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |