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

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

by ikegami (Patriarch)
on Mar 06, 2014 at 15:36 UTC ( [id://1077243]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    >perl -MO=Concise,-exec -e"my @a = ( $c, $c += 1 );"
    1  <0> enter
    ...
    a  <2> aassign[t5] vKS/COMMON
    b  <@> leave[1 ref] vKP/REFC
    -e syntax OK
    
  2. or download this
    my $c = 4;
    sub c :lvalue { print("$_[0]\n"); $c } 
    my @a = ( c("a"), c("b") += 1 );
    print("@a\n");
    
  3. or download this
    a
    b
    5 5
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-20 03:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found