http://www.perlmonks.org?node_id=1187173


in reply to Re^4: Syntax for casting map to a hash or an array
in thread Syntax for casting map to a hash or an array

Yep, both of those work, however not for the same reason.

Dumper takes a reference of any type.

This:

{map { $_ => 'fish' } qw(one two red blue)}

... takes whatever is compiled by map, then with the outer braces, converts that into a hash reference, then returns the hash ref (same for the next one with an array). Putting the sigil in front of that block, and it will deref the created reference into a hash, and return it as a hash as opposed to a reference. For Dumper, you'd then need to dereference it before sending it in as a parameter.