Keep It Simple, Stupid | |
PerlMonks |
Re^2: strange map behaviorby CountZero (Bishop) |
on Feb 25, 2008 at 19:44 UTC ( [id://670107]=note: print w/replies, xml ) | Need Help?? |
Your using a 'fat comma' (aka the "quoting comma": =>) That is a very confusing statement. From the mouth of the Camel: The => operator is just a synonym for a comma, but it's more visually distinctive and also quotes any bare identifiers to the left of it. $_ not being a bare identifier, the 'fat comma' is just a comma here. Actually my %h = map { "$_" , "$_" } @arr ; gives the same syntax error as my %h = map { "$_" => "$_" } @arr ; proving that the 'fat comma' has nothing to do with the error. It are the double quotes that confuse the interpreter. CountZero A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
In Section
Seekers of Perl Wisdom
|
|