This fails:
my @a = ('a', 'b', 'c', 'd', 'e'); my %h = map { 'prefix-$_' => 1 } @a;
with this error:
Not enough arguments for map at foo.pl line 4, near '} @a'
but this works:
my @a = ('a', 'b', 'c', 'd', 'e'); my %h = map { 'prefix-' . $_ => 1 } @a;
why?
Because Perl is guessing an EXPR (a hash reference, for example) instead of a BLOCK. This should work (note the ‘+’ symbol):
See http://perldoc.perl.org/functions/map.html.