Never seen system with that syntax before... here's what I'd do though:
if (-e $file) {
if (unlink $file) { warn "File $file WAS removed."; }
}
That's just my first guess though having not tested it. :)
> -----Original Message-----
> From: Peter Lemus [mailto:[EMAIL PROTECTED]]
> Sent: 10 May 2001 10:27
> To: [EMAIL PROTECTED]
> Subject: check to see if file exists.
>
>
> 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";
>
>
> =====
> Peter Lemus
> Computer Networks Engineer
> [EMAIL PROTECTED]
> My Dad always tought me; when you do good; expect to receive
> good; when you do bad; expect the bad...sooner or later.
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
>