Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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

by linuxer (Curate)
on Mar 04, 2014 at 21:26 UTC ( #1076965=note: print w/replies, xml ) Need Help??


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

Missed precedence. Eily's explanation reads much better than mine.

$c points to a memory address with a stored value. Your assignment changes that value. So at the end, you have an array reference containing the same address (with the same incremented value). And you are printed the same value.

  • Comment on Re: 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
Node Status?
node history
Node Type: note [id://1076965]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2020-05-30 12:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (172 votes). Check out past polls.

    Notices?