Now, when I test the output upon changing the log values locally, I get exactly the outputs I want; I am using Perl 5.8.8. However, when I test it on my server, which is using Perl 5.6.1 my server-side include to call this file from HTML does some really funky stuff (it actually shows two green, one yellow, two red, one yellow then one red,) but I think that may be a different issue with my server configuration. Should I upgrade the Perl version on my server to get this to execute correctly? Or, are you guys still seeing problems with my code? Thanks for any help.use strict; use warnings; my $logfile="log.txt"; my $error="DOWN"; my $warn="PROBLEM"; my $redbutton="\<img src\=\'default_files/perlredblink\.gif'>"; my $greenbutton="\<img src\=\'default_files/perlgreenblink\.gif'>"; my $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 "$button"; } elsif ($_ =~ /$warn/i) { $button = $yellowbutton; print "<!--Content-type: text/html-->\n\n"; print "$button"; } else { print "<!--Content-type: text/html-->\n\n"; print "$button"; } } close LOG;
In reply to Re^4: trouble parsing log file...
by perl_geoff
in thread trouble parsing log file...
by perl_geoff
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |