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

Re^4: Array of variables

by dbuckhal (Scribe)
on May 28, 2013 at 21:06 UTC ( #1035732=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Array of variables
in thread Array of variables

I thought I replicated the OP's code, but did not have a problem with the post-increment of the array element. So, I am confused that my code seems to work, whereas the OP's does not.

Note how my output does increment the elements. Did I present code that replicates the OP's scenario, or am I off target here?

Thanks!


Comment on Re^4: Array of variables
Re^5: Array of variables
by frozenwithjoy (Curate) on May 28, 2013 at 21:30 UTC
    The difference is that you are actually printing the thing you are incrementing rather than incrementing one item and printing another completely distinct item. What the OP did is more like the final print statement here:
    perl -E ' my ( $x, $y, $z ) = ( 1, 2, 3 ); my @a = ( $x, $y, $z ); say join " ", map { $_++, $_ } @a; say "@a"; say "$x $y $z"; ' 1 2 2 3 3 4 2 3 4 1 2 3
      Well, let me just
      perl -E ' say "Thanks!" '

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2014-04-24 13:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (566 votes), past polls