http://www.perlmonks.org?node_id=1883

vroom has asked for the wisdom of the Perl Monks concerning the following question:

Replies are listed 'Best First'.
Re: How do I delete a file?
by Anonymous Monk on Feb 14, 2000 at 05:16 UTC
    With unlink:
    # unlink returns the number of files it successfully deleted $cnt = unlink 'a', 'b', 'c'; if (unlink @goners == @goners){ print "I deleted 'em all! HaHaHa\n"; } unlink <*.bak>; unlink $filename or die "Couldn't delete $filename: $!";