I have some questions about Perl's "map" function.
Specifically:
How does
%hash = map {$_ => 1} @array
create a hash mapping array's elements to 1? How does block return a list of two elements? I thought block returns its last value. Does => implicitly create a list, as opposed to "," that returns its right argument?
Why does
%hash = map ($_ => 1), @array
not work? I am trying to return a list of two elements here... And how does prepending "+" before ")" fix it, from the parser's point of view?