in reply to Re^2: trouble parsing log file...
in thread trouble parsing log file...
EDIT:
Success! I got it now, thanks for your help everyone!
use warnings; $logfile="log.txt"; $error="DOWN"; $warn="PROBLEM"; $redbutton="\<img src\=\'default_files/perlredblink2\.gif'>"; $greenbutton="\<img src\=\'default_files/perlgreenblink\.gif'>"; $yellowbutton="\<img src\=\'default_files/perlyellowblink\.gif'>"; open LOG, $logfile or die "Cannot open $logfile for read :$!"; my $button = $greenbutton; while (<LOG>) { if ($_ =~ /$error/i) { $button = $redbutton; print "<!--Content-type: text/html-->\n\n"; print "$redbutton"; } if ($_ =~ /$warn/i) { $button = $yellowbutton; print "<!--Content-type: text/html-->\n\n"; print "$yellowbutton"; } } close LOG;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: trouble parsing log file...
by McDarren (Abbot) on Nov 21, 2006 at 16:04 UTC | |
Re^4: trouble parsing log file...
by perl_geoff (Acolyte) on Nov 21, 2006 at 18:21 UTC | |
by jarich (Curate) on Nov 23, 2006 at 14:41 UTC | |
by perl_geoff (Acolyte) on Nov 28, 2006 at 13:43 UTC |
In Section
Seekers of Perl Wisdom