http://qs321.pair.com?node_id=1187190


in reply to Why does ‘keys’ need a named hash?

I read the answers above and feel the issue could be further clarified... The question is about braces and the ways in which they are used in perl.

To work with hashes, two useful syntaxes should be understood.

With map, the braces have an ambiguous meaning: they could be a hash constructor, or (more commonly), a BLOCK. To avoid confusion, you might want to rewrite the map expression using parentheses this time: map(( $_ => 1 ), @list).

Finally, if you intend to use a hash (a data structure that cannot have duplicate keys) to implement the uniq routine, you must at some step construct one! Either anonymous or named one; but for anon case, you'll have the extra braces.