CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [Laurent_R] iterating through an array using XML::Simple: Edit Log



rovf
Veteran

Oct 23, 2012, 5:31 AM


Views: 1000
Re: [Laurent_R] iterating through an array using XML::Simple


Quote
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:


Code
@FC_Names['$i']->


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)


Edit Log:
Post edited by rovf (Veteran) on Oct 23, 2012, 5:32 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives