Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Why does the first $c evaluate to the incremented value in [$c, $c += $_] ?

by derby (Abbot)
on Mar 04, 2014 at 21:23 UTC ( #1076960=note: print w/replies, xml ) Need Help??


in reply to Re: Why does the first $c evaluate to the incremented value in [$c, $c += $_] ?
in thread Why does the first $c evaluate to the incremented value in [$c, $c += $_] ?

Wild guess here but since the anonymous array is on the right side of a list operator, then the comma has really low precedence -- lower than assignment. By adding the +0, you give both terms equal precedence so it goes back to leftward precedence? Well ... that's my guess.

-derby

update: what Eily says makes better sense given the simple example of

use Data::Dumper; my $c = 0; my $d = [ $c, $c += 2 ]; print Dumper( $d );

  • Comment on Re^2: Why does the first $c evaluate to the incremented value in [$c, $c += $_] ?
  • Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (1)
As of 2022-01-19 04:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (55 votes). Check out past polls.

    Notices?