in reply to Re^2: XML::Twig - How do I check to see if an element exists in root?
in thread XML::Twig - How do I check to see if an element exists in root?
# specify twig_handlers (see the XML::Twig documentation) twig_handlers => { # create a new hash-ref map { # transform a list into a new list # create a name / subroutine pair $_ => sub { # when the subroutine is called # get the element name from $_->name() # and increase it's count entry in %found # # note: $_ is set by XML::Twig when the sub is called $found{$_->name()}++ }; } @nodes # for each element in @nodes }
See also map.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: XML::Twig - How do I check to see if an element exists in root?
by dbmathis (Scribe) on Jul 09, 2007 at 17:15 UTC | |
by Joost (Canon) on Jul 14, 2007 at 00:04 UTC | |
by dbmathis (Scribe) on Jul 21, 2007 at 16:25 UTC |