Using the proper tools (an XML parser, not regular expressions), it becomes pretty simple:
use XML::XPath; my $xp = XML::XPath->new(filename => '/path/to/file'); foreach ('IP-ADDRESS', 'IP-NEIGHBOUR') { foreach my $ip ($xp->findnodes("//$_")) { print $ip->findvalue('.'), "\n"; } }
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: Extracting tagged data from a XML file
by davorg
in thread Extracting tagged data from a XML file
by theroninwins
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |