--- Peter Lemus <[EMAIL PROTECTED]> wrote:
> Hi, I need to check to see if a file exists in a
> directory, if it does then delete it, else ......
>
> is this the correct syntax?
>
> if (-e $file and -f _) {
> system ("del $file") ? print "File $file deleted\n"
> : warn "File $file WAS removed: $!\n";
I wouldn't do a system call. Try:
unlink $file if -e $file and -f _;
You can also use the if(){} structure above if you want to
double-check. Unlink returns the number of files so removed (I think =o)
=====
print "Just another Perl Hacker\n"; # edited for readability =o)
=============================================================
Real friends are those whom, when you inconvenience them, are bothered less by it than
you are. -- me. =o)
=============================================================
"There are trivial truths and there are great Truths.
The opposite of a trival truth is obviously false.
The opposite of a great Truth is also true." -- Neils Bohr
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/