Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Concatenating Array elements

by muba (Priest)
on Aug 19, 2014 at 20:39 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1098044]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 04:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found