#!/bin/perl -w use strict; use XML::Twig; use constant URL => q{http://perlmonks.org/index.pl?node=chatterbox+xml+ticker}; my $t= XML::Twig->new( twig_handlers => { message => \&display_message }); $t->parseurl( URL); sub display_message { my( $t, $msg)= @_; my $auth = $msg->att( 'author'); my $cont = $msg->text; my $time = $msg->att( 'time'); my ($h,$m,$s) = $time =~ /^\d{8}(\d\d)(\d\d)(\d\d)$/; $cont =~ s/\n//g; $cont =~ s/^\/me/$auth/; print "$h:$m:$s - [$auth] $cont\n"; }