++ed by:
RWSTAUNER ALEXBIO SALVA RHAEN SCHWIGON

139 PAUSE users
116 non-PAUSE users.

Nicholas Clark
and 1 contributors

# chunk: #!perl # examples shamelessly snatched from perldoc -f map

# chunk: # translates a list of numbers to the corresponding characters. @chars = map(chr, @nums);

# chunk: %hash = map { getkey($_) => $_ } @array;

# chunk: { %hash = (); foreach $_ (@array) { $hash{getkey($_)} = $_; } }

# chunk: #%hash = map { "\L$_", 1 } @array; # perl guesses EXPR. wrong %hash = map { +"\L$_", 1 } @array; # perl guesses BLOCK. right

# chunk: %hash = map { ("\L$_", 1) } @array; # this also works

# chunk: %hash = map { lc($_), 1 } @array; # as does this.

# chunk: %hash = map +( lc($_), 1 ), @array; # this is EXPR and works!

# chunk: %hash = map ( lc($_), 1 ), @array; # evaluates to (1, @array)

# chunk: @hashes = map +{ lc($_), 1 }, @array # EXPR, so needs , at end