I am trying to write a simple filter that will mark in different colors certain words as they pass through.
For example, if I do a tail -f /var/log/messages I want words I am looking for to be in red and other words in yellow with the rest of the text unchanged. (There might be a way to do this already, but you can learn a lot by reinventing wheels sometimes!) Here's the basic frame of code I'm using: #!/usr/bin/perl -w use strict; my $line; while(1) { $line = <STDIN>; # Highlighting code goes here... print $line; } When I use a command like "cat textfile.txt | ./filter-test.pl" I get the text file printed out, just like I want, followed by an infinate number of "Use of uninitialized value in print at ./filter-test.pl line 9, <STDIN> line 185." But, when I use the command "tail -f /var/log/messages | filter-test.pl", it works fine. How do I correctly terminate the loop at the end of the input? Thanx! -Michael -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]