in reply to trouble parsing log file...
Ignore the list building and just work through the file line by line and use a regular expression to test.
Take a look at the following as an example.
use strict; # Set the button to green initially my $button = "perlgreenblink"; # test the file line by line. # The line gets read into $_ # I am testing on the DATA segment to illustrate the point while (<DATA>){ # test with a regex and end the # while loop if there is a problem if (/DOWN/){ $button = "perlredblink2"; last; } if (/PROBLEM/){ $button = "perlyellowblink"; last; } } print "HTML for <img src=\"$button.gif\" />\n"; __DATA__ nothing here going smoothly Its all going DOWN no PROBLEM at all
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: trouble parsing log file...
by perl_geoff (Acolyte) on Nov 20, 2006 at 20:25 UTC | |
by inman (Curate) on Nov 20, 2006 at 20:48 UTC | |
by perl_geoff (Acolyte) on Nov 20, 2006 at 21:01 UTC | |
by inman (Curate) on Nov 20, 2006 at 21:18 UTC | |
A reply falls below the community's threshold of quality. You may see it by logging in. |