XP is just a number | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hi Michael,
please ask for everything you didn't understand. I think you're on a very good way and I don't want to stop you because of too short or bad written comments. Now I understand, why you're only parsing one xml file. Here is a really complicated, but short solution for this: It is your grep (which returns an array of matching items) but as you only expect one element in the array, the grep-result is forced to be an array using the ( ) around grep. The combination of ( ) and &91; &93; allows you to fetch a specific array item without writing it to an array first. Another comment on your original article already told you that you might not get a array from the XML parser if only one inside object is found. There was a hint for a solution. To check this, you should print the thing you use as a array reference: If this isn't an array reference (shown as ARRAY(0x12345)), you could force it to be one: ref() tests if the parameter is a reference and returns the type of reference (in this case, ARRAY). If your value isn't what you expect (an ARRAY - reference), it creates one and fills in the old value into the new array. In reply to Re^3: XML Parsing,
by Sewi
|
|