Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Concatenating Array elements

by muba (Priest)
on Aug 19, 2014 at 20:39 UTC ( #1098044=note: print w/replies, xml ) Need Help??


in reply to Concatenating Array elements

Your code will only modify the value of $array[7] (which was 8: remember that array indexes start at 0, not at 1). In other words, after $array[7] = $array[7] + $array[8], your array will contain (1, 2, 3, 4, 5, 6, 7, "89", 9, 10).

The index of the element with value 9 is still 8 as it has always been (again, array indexes start at 0, not at 1). No elements have been moved around or deleted. Only the 8th element (the one with index 7) has been altered.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2019-10-22 08:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?