Perl, deleting an .xml file created and open with 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 5:03 UTC
Read the original article Hit count: 221

Filed under:
|
|

So I'm running through a list of things and have code that creates an .xml file 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