> I have to say that I'm very lucky because the document keeps a very well 
> defined order of <topic/> and <ExternalPage/>...

Not really, think how much programming effort would it take to generate a 
file where <Topic/> and corresponding <ExternalPage/> would be intermixed :)
 
> The last question about my approach is, I found a good place to close an 
> opened file handler, it's just the first line in sub _topic_handler, 
> however, how can I write some if statement to say, if FH is opened, then 
> close it?

Assuming that you keep only one file open at a time and your filehandle is 
the same for all files (e.g. FH) you can simply add to the very start of 
_topic_handler:

close (FH) if (fileno FH);

read perldoc perlfunc to see what fileno does.


Peter

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to