in reply to Filehandle open or not - WTF? :(
Your question seems to have been answered by other notes, but I was curious about this: if ( ($_ =~ m/error/i) or ($_ =~ m/warning/i) ) -- wouldn't it be clearer to say something like if (/error/i or /warning/i) ? If you aren't going to name the variable, you might as well use more concise code.
You're also adding quotes where you don't need them, on each call to print "$_". And even more, print defaults to printing $_ so you could change print "$_" to print
Personally I use more variables, but I like maximum verbosity. So I'd have things like while ($line = <LOG>) and then print $line but that's just my personal style...
Oh, and the main reason I ask about all of this is that I've seen a lot of other monks make these suggestions -- so I'm partially curious as to why they weren't suggesting these things here... OK, I'll be quiet now. :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Filehandle open or not - WTF? :(
by clairudjinn (Beadle) on Mar 12, 2003 at 07:06 UTC | |
by Nkuvu (Priest) on Mar 12, 2003 at 15:25 UTC |