in reply to Returning the right results, but at the wrong time from subroutines

Also completely un-related to your problem... you can eliminate your print_file_name sub, and use the basename function from the File::Basename module instead. Less code for you to maintain, and it's more portable.

Regarding your problem... if it is possible for you to post a very small sample of your XML code here, please do so, as that would allow any of us to easily duplicate your problem. I followed your link, but it asked me to create some kind of account. That's too much of a commitment for me :)

Also, your code layout is a little difficult to follow. I used perltidy to clean it up a bit. You could do that also, and re-post, if you are so-inclined.

Update: I believe you should call $twig->parsefile() immediately after you call the twig constructor (new()), not near the end of your foreach loop.

Replies are listed 'Best First'.
Re^2: Returning the right results, but at the wrong time from subroutines
by leighgable (Acolyte) on Sep 07, 2009 at 00:55 UTC
    Thanks for the comments. I have updated my post to include an easier download of the sample data directory, and posted a snippet of the aforementioned xml.