in reply to Returning the right results, but at the wrong time from subroutines
Looks like within the loop you first create the XML::Twig parser, then use the global variables containing the extracted data, then you clear those variables and THEN you parse the XML file and fill in the globals.
That doesn't look right. And explains the behaviour. For the first iteration the globals are empty, for subsequent iterations they contain the data extracted from the previous file.
You want to move the ->parsefile() and ->purge() calls immediately under the my $twig = XML::Twig -> new(...);.
Jenda
Enoch was right!
Enjoy the last years of Rome.
|
|---|