Cool/useful short examples of Perl?

Simon Cozens simon at simon-cozens.org
Thu Jun 2 08:40:11 BST 2011


On 01/06/2011 18:55, Peter Edwards wrote:
> Here's an idiot simple code colorizer for logs / diffs that I use quite a
> lot
> http://blogs.perl.org/users/peter_edwards/2010/08/colorized-perl-code-snippets-on-ansi-terminals.html

Here's my idiot simple log colorizer:

use Config::Auto; use Term::ANSIColor; $|=1;
my %config = %{Config::Auto::parse()};
while (<>) {
    for my $re (keys %config) { /$re/i && print color($config{$re}) }
    chomp; print $_, color('reset'),"\n";
}


More information about the london.pm mailing list