Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

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?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2021-03-05 14:29 GMT
Find Nodes?
    Voting Booth?
    My favorite kind of desktop background is:

    Results (112 votes). Check out past polls.