in reply to Extracting XML data from a tree
use XML::Twig; use strict; use warnings; my $twig = XML::Twig->new(twig_handlers => { Day => \&Day }); $twig->parsefile('CC.xml'); exit; sub Day { my ( $twig, $day ) = @_; if ($day->att('day-of-week') eq 'Tuesday') { print $day->first_child('Times')->first_child('Time')->att('st +art-time'), "\n"; } } __END__ 02:00
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extracting XML data from a tree
by perlvroom (Acolyte) on Jun 04, 2013 at 20:14 UTC |