2 # examples shamelessly snatched from perldoc -f map
4 # translates a list of numbers to the corresponding characters.
5 @chars = map(chr, @nums);
7 %hash = map { getkey($_) => $_ } @array;
12 $hash{getkey($_)} = $_;
16 #%hash = map { "\L$_", 1 } @array; # perl guesses EXPR. wrong
17 %hash = map { +"\L$_", 1 } @array; # perl guesses BLOCK. right
19 %hash = map { ("\L$_", 1) } @array; # this also works
21 %hash = map { lc($_), 1 } @array; # as does this.
23 %hash = map +( lc($_), 1 ), @array; # this is EXPR and works!
25 %hash = map ( lc($_), 1 ), @array; # evaluates to (1, @array)
27 @hashes = map +{ lc($_), 1 }, @array # EXPR, so needs , at end