http://www.perlmonks.org?node_id=585287


in reply to Re^3: trouble parsing log file...
in thread trouble parsing log file...

Your problem is here...
$logfile="log.txt";
and here...
if ($logfile =~ /$error/i) {
Can you see?
You are trying to match the string "DOWN" against the string "log.txt". Of course, that will never match :)

I think you want:

while (my $line = <LOG>) { if ($line =~ /$error/i) { etc....

Cheers,
Darren :)