#!/usr/local/bin/perl -w
use Getopt::Long;
my $ret = GetOptions ("f|filename:s");
my $filename = $opt_f || die "Usage: $0 -f filename\n";
if (-e $filename)
{
# Delete the file.
if (unlink ($filename))
{
print "The file $filename has been deleted.\n";
}
else
{
print "The file $filename was not deleted: $!\n";
}
}
else
{
print "The file $filename does not exist.\n";
}
|