Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Extracting tagged data from a XML file

by davorg (Chancellor)
on Aug 31, 2004 at 12:15 UTC ( #387171=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://387171]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2022-06-30 07:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (97 votes). Check out past polls.

    Notices?