Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: strange map behavior

by CountZero (Bishop)
on Feb 25, 2008 at 19:44 UTC ( [id://670107]=note: print w/replies, xml ) Need Help??


in reply to Re: strange map behavior
in thread strange map behavior

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

Replies are listed 'Best First'.
Re^3: strange map behavior
by Anonymous Monk on Feb 25, 2008 at 22:51 UTC
    Hey, thanks. I should have checked that the ordinary ',' operator worked similarly in this situation before I posted. I stand corrected and educated.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://670107]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-19 19:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found