use strict; use XML::Simple; use LWP::Simple; use constant URL => q|http://perlmonks.org/index.pl?node=chatterbox+xml+ticker|; $| = 1; my $cb_ticker = get(URL) or die "site down!"; my $xml = XMLin($cb_ticker,forcearray=>1) or die "xml error!"; foreach my $msg (@{$xml->{'message'}}) { my $auth = $msg->{'author'} || ''; my $cont = $msg->{'content'} || ''; my $time = $msg->{'time'} || ''; $time = join(":", $time =~ /^\d{8}(\d\d)(\d\d)(\d\d)$/) if $time; $cont =~ s/\n//g; $cont =~ s/^\/me/$auth/; print "$time - [$auth] $cont\n"; }