in reply to Nested XML Question

Think this is a start of what you're looking for

use XML::Parser; my @prefix; sub start { my ($p, $_, %attr) = @_; push(@prefix,$attr{name}) if defined $attr{name}; push(@prefix,'') if not defined $attr{name}; } sub ips { my ($p, $_) = @_; s/\s//g; return unless @prefix; for my $ip (split(',')) { print join('.',@prefix)," $ip\n"; } } sub end { pop @prefix; } my $parser = new XML::Parser(); $parser->setHandlers(Start => \&start, Default => \&ips, End => \&end) +; $parser->parsefile('xml');

Replies are listed 'Best First'.
Re^2: Nested XML Question
by Anonymous Monk on Jun 25, 2013 at 06:35 UTC