TCM has asked for the wisdom of the Perl Monks concerning the following question:
Hi! I'd like to delete a file and us "or warn" to write a warning message to a log file for any warnings that are incountered. If there are no warnings and the file is deleted successfully, then I'd like to print a "successfully deleted" message to a log file. The code below will print the "successfully deleted" message everytime, how can I code it so that it only prints the "successfully deleted" message to the log file when there are no warnings? Thank you to any who can help me out.
$ftp->delete($file) or warn print LOG "Cannot delete $file - ", $ftp- +>message; print LOG "$file successfully deleted\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: or warn question
by sauoq (Abbot) on Jun 08, 2012 at 18:47 UTC | |
by TCM (Acolyte) on Jun 08, 2012 at 19:29 UTC | |
|
Re: or warn question
by BrowserUk (Patriarch) on Jun 08, 2012 at 19:35 UTC | |
|
Re: or warn question
by clueless newbie (Curate) on Jun 08, 2012 at 18:28 UTC | |
by TCM (Acolyte) on Jun 08, 2012 at 19:01 UTC | |
|
Re: or warn question
by AnomalousMonk (Archbishop) on Jun 08, 2012 at 22:17 UTC | |
|
Re: or warn question
by zentara (Cardinal) on Jun 08, 2012 at 18:52 UTC | |
by chromatic (Archbishop) on Jun 08, 2012 at 19:25 UTC | |
by TCM (Acolyte) on Jun 08, 2012 at 19:30 UTC | |
|
Re: or warn question
by druthb (Beadle) on Jun 09, 2012 at 13:00 UTC |