How can I delete a file created and opened with Perl's IO::File and XML::Writer?

Posted by Sho Minamimoto on Stack Overflow See other posts from Stack Overflow or by Sho Minamimoto
Published on 2010-04-17T04:59:09Z Indexed on 2010/04/17 13:43 UTC
Read the original article Hit count: 294

Filed under:
|
|

So I'm running through a list of things and have code that creates an .xml files with IO::File called $doc, then I make a new writer with XML::Writer(OUTPUT => $doc). More code runs and I build a big XML file with XML::Writer. Then, near the end of the file, I find out if I need this file at all. If I do need it, I just:

 $writer->end(); $doc->close(); 

but if I don't need it, what should I enter to just delete all data I've stored/saved and move onto the next file? I tried unlink($docpath) (before and after $doc->close()), the file was not deleted.

© Stack Overflow or respective owner

Related posts about perl

Related posts about file-io