nparse takes care of new for you (hence the "n"), what you need in this case is probably xparse , or just let the module figure it out and do it:
my $url= 'http://192.168.1.205:13000/status.xml'; my $twig= XML::Twig->parse( twig_roots => { 'smsc/received' => sub { $author= $_[1]->text;}}, $url ); $twig->print;
source share