Oct 23, 2012, 5:31 AM
Re: [Laurent_R] iterating through an array using XML::Simple
Don't use quotes marks around $i in your array subscript.
This too, but there are more problems with this (and the OP would have found out that something is wrong if he had enabled strict and warnings).
Still, I wonder, why this code did not die; maybe there is some obscure feature in Perl which I don't know yet? Consider the code snippet of the posting:
You were of course correct in mentioning, that the array index must be a number, not a string. However, the OP claimed that element 0 was always selected, and this piece of code certainly does not supply a zero.
Further, wie see that the OP uses an array slice, not an array element. How is it possible to apply the arrow operator, if the left argument is a slice (i.e. a list) instead of a scalar? Obviously it does something (instead of just terminating with an error message)....
(This post was edited by rovf on Oct 23, 2012, 5:32 AM)