#!/usr/bin/perl use strict; use warnings; die "Usage: tail -f | $0\n" if @ARGV; use Term::ANSIColor; use Switch; while (<>) { chomp; my ( $time, $type, @args ) = split /\t/; switch ($type) { case 'message_to' { print color('bold blue'), join( ' <-- ', @args ) } case 'message_from' { print color('bold green'), join( ' --> ', @args ) } else { print color('yellow'), "[$type] @args" } } print color('reset'), "\n"; }