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. :)
In reply to Re: Filehandle open or not - WTF? :(
by Nkuvu
in thread Filehandle open or not - WTF? :(
by Rhodium
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |