http://qs321.pair.com?node_id=670051

jeanluca has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks
Most of the time map surprises me, it always generates output I don't expect. This time however it goes beyond this. Here is my test code:
#! /usr/bin/perl -l use strict; use warnings ; my @arr = qw(1 2 3 4 5) ; my %h = map { "$_" => "$_" } @arr ; print "$_ --> $h{$_}" foreach ( keys %h ) ;
Which returns
syntax error at ./t.pl line 7, near "} @arr " Execution of ./t.pl aborted due to compilation errors.
However when I change the map-line into: my %h = map { $_."" => "$_" } @arr ; it works and produces
4 --> 4 1 --> 1 3 --> 3 2 --> 2 5 --> 5

This is truly map magic for me! Anyone out there who has already walked this path ?

CHeers
LuCa

Update: thnx monks, I appreciate the help!!