in reply to Warning counter
You almost had it... You just can't increment inside quotes like that. But, warn takes a list just like print does.
open ( F, $filename ) or warn "Cannot open $filename (", $counter++, " +): $!\n";
If you want, you can use a do block to do more complex things if the open fails.
open ( F, $filename ) or do { $counter++; warn "Cannot open $filename ($counter): $!\n"; # And whatever else you want... };
-sauoq "My two cents aren't worth a dime.";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Warning counter
by Thelonius (Priest) on Jul 01, 2003 at 18:08 UTC | |
by broquaint (Abbot) on Jul 02, 2003 at 15:19 UTC | |
|
Re: Re: Warning counter
by Anonymous Monk on Jul 01, 2003 at 17:36 UTC |