Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm unlinking a file and need to print to the screen AND push(@list, $file) if it fails all in one go.
I don't suppose something like this would be the best way? It's untested but I'm sure it works but still, I don't really care to use a sub for this.
unlink $file or &oopsies($file); sub oopsies { print "Error!"; push(@list, shift); #<-- heck, I've never tried using SHIFT like th +is- so intriguing I'm going to test that. }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: unlink $file OR... OR..
by GrandFather (Saint) on Aug 30, 2007 at 03:49 UTC | |
|
Re: unlink $file OR... OR..
by bobf (Monsignor) on Aug 30, 2007 at 03:45 UTC | |
|
Re: unlink $file OR... OR..
by sulfericacid (Deacon) on Aug 30, 2007 at 03:43 UTC | |
|
Re: unlink $file OR... OR..
by kyle (Abbot) on Aug 30, 2007 at 03:50 UTC | |
|
Re: unlink $file OR... OR..
by Prof Vince (Friar) on Aug 30, 2007 at 13:58 UTC |