|Think about Loose Coupling|
Re: trouble parsing log file...by liverpole (Monsignor)
|on Nov 20, 2006 at 19:52 UTC||Need Help??|
You are trying to compare a list against a scalar in this line:
What I suspect you want to do instead is to iterate through the list, and break out of the loop when you find the condition you're looking for (note that you don't need to quote variable names to print them):
The above will look through each line read in from the file, and print $redbutton or $yellowbutton if the appropriate string is matched.
I also did a chomp @logfile to remove the newline from each logfile line, so that the match doesn't have to explicitly declare it.
Also, the variable got_button was used so that, when you've gone through all the lines from the file, if the match wasn't found, you know to display the $greenbutton.
Hope that helps!