*A* way.
use strictures; use XML::LibXML; my $dom = XML::LibXML ->load_xml({ IO => \*DATA }); my $last = [ $dom->findnodes("/library/book[last()]") ]->[0]; print $last->findvalue("title"), $/; __DATA__ <library> <book> <title>Perl Best Practices</title> <src>Use python. But I keed!</src> </book> <book> <title>Perl Cookbook, Second Edition</title> <src>You would make more cooking meth. But I keed!</src> </book> <book> <title>Guitar for Dummies</title> <src>Stratocaster. Oh, I'm sorry, did I stutter?</src> </book> </library>
In reply to Re: perl & XML: getting last child?
by Your Mother
in thread perl & XML: getting last child?
by ambrill
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |