Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: How to validate %hash = ( 'a' => 'b', ...);

by Anonymous Monk
on Sep 12, 2016 at 07:29 UTC ( [id://1171563]=note: print w/replies, xml ) Need Help??


in reply to Re: How to validate %hash = ( 'a' => 'b', ...);
in thread How to validate %hash = ( 'a' => 'b', ...);

... I expected omitting the redundant quotes to produce "bareword" errors under strict ... but funnily the auto-quoting effect of the fat comma => has higher precedence than the concat operator. (?)

Um ... operator effect precedence? As different from operator precedence? I don't like that phrasing :D

http://perldoc.perl.org/perlop.html#Comma-Operator says

The special quoting behavior ignores precedence, and hence may apply to part of the left operand:
print time.shift => "bbb";
That example prints something like "1314363215shiftbbb" , because the => implicitly quotes the shift immediately on its left, ignoring the fact that time.shift is the entire left operand.

At least this phrasing doesn't bring up precedence, but still seems forced

First part is much better

The => operator (sometimes pronounced "fat comma") is a synonym for the comma except thatit causes a word on its left to be interpreted as a string if it begins with a letter or underscore and is composed only of letters, digits and underscores.

shift is the word on the left, thats the rule, no matter the "entire left operand" , big fat comma quotes the word on the left, the end :)

Replies are listed 'Best First'.
Re^3: How to validate %hash = ( 'a' => 'b', ...);
by LanX (Saint) on Sep 12, 2016 at 10:08 UTC
    Well, documented or not that's a good candidate for an extra warning.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

Log In?
Username:
Password:

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

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

    No recent polls found