I want to get a specific string, for example 123 in <received>123</received> from some XML that will be retrieved from a URL.
I have write a code but stuck with an error message:
Attempt to bless into a reference at /usr/share/perl5/XML/Twig.pm line 392.
How can I solve it?
The code:
use XML::Twig;
use LWP::Simple;
my $url = 'http://192.168.1.205:13000/status.xml';
my $twig = new XML::Twig(TwigRoots => {
'smsc/received' => sub {$author = $_[1]->text; }});
$twig->nparse( $url );
$twig->print;