% ./highlight.pl
####
% cat highlight.pl | ./highlight.pl
####
#!/usr/bin/perl -w
use strict;
use warnings;
my $b_windows = ($^O =~ /win/i)? 1: 0;
if ($b_windows) {
require Win32::Console::ANSI;
print "\e[H\e[J";
}
my $color1 = $b_windows? "\e[1;42m": "\e[102m";
my $color2 = $b_windows? "\e[1;45m": "\e[105m";
my $a_lines = [
"# Stopping By Woods On A Snowy Evening -- Robert Frost",
"# ",
"# Whose woods these are I think I know.",
"# His house is in the village though;",
"# He will not see me stopping here",
"# To watch his woods fill up with snow.",
"# ",
"# My little horse must think it queer1",
"# To stop without a farmhouse near",
"# Between the woods and frozen lake",
"# The darkest evening of the year.",
"# ",
"# He gives his harness bells a shake",
"# To ask if there is some mistake.",
"# The only other sound's the sweep",
"# Of easy wind and downy flake.",
"# ",
"# The woods are lovely, dark and deep.",
"# But I have promises to keep,",
"# And miles to go before I sleep,",
"# And miles to go before I sleep.",
];
my $pattern = "wood";
if (-t STDIN) {
# Program being run standalone: "