Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: ~~ and list literal

by ikegami (Pope)
on Oct 27, 2012 at 00:15 UTC ( #1001146=note: print w/replies, xml ) Need Help??


in reply to Re^2: ~~ and list literal
in thread ~~ and list literal

Why does "x" ~~ "a", "b", "c" always give 1?

It doesn't; it evaluates to "c".

"," is a very low precedence operator. "x" ~~ "a", "b", "c" means ("x" ~~ "a"), "b", "c", which evaluates to "c" in scalar context.

And why does "x" ~~ sub { "a", "b", "c" } also give 1?

It doesn't; it evaluates to "c".

"x" ~~ sub { "a", "b", "c" } is the same as scalar( sub { "a", "b", "c" }->($x) ). Since  "a", "b", "c" evaluates to "c" in scalar context, that is what is returned.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001146]
help
Chatterbox?
[MidLifeXis]: Project Admin, a while ago: "No, I would prefer you didn't close that ticket yet confirming $vendor's support process yet. Continue to periodically check back to see if it has changed."...
[MidLifeXis]: Project Admin, today, after many periodic updates from me: "Why hasn't this been closed yet? Is there anything I can do to get this closed?" <facepalm>
[MidLifeXis]: In addition to SOAP (last hour of cb), try water. ;-)

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2017-01-19 12:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (170 votes). Check out past polls.