in reply to Re: Extracting tagged data from a XML file
in thread Extracting tagged data from a XML file

If you ever need to get unique values in Perl then you should think about using a hash.

use XML::XPath; my $xp = XML::XPath->new(filename => '/path/to/file'); my %seen; foreach ('IP-ADDRESS', 'IP-NEIGHBOUR') { foreach my $ip ($xp->findnodes("//$_")) { my $addr = $ip->findvalue('.'); print "$addr\n" unless $seen{$addr}++; } }
--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
Re^3: Extracting tagged data from a XML file
by theroninwins (Friar) on Aug 31, 2004 at 12:35 UTC
    Which brings me back to where I was before how do it get XPATH?

      You get all Perl modules from CPAN.

      --
      <http://www.dave.org.uk>

      "The first rule of Perl club is you do not talk about Perl club."
      -- Chip Salzenberg

        OK here is the prob I need to do it without any special pm file. It is for work and they don't want to install any special files because it has to run on all computers. Any idea on how to do it?? like on my last post I am now trying to do if with jumping to the key word but something is not quit working still