in reply to Extracting tagged data from a XML file
The essence of the problem lines with in the regular expression -- I'd suggest some reading up on them if you want to get serious with data extraction. Of course, the regex might change based on your XML file.#!/usr/bin/perl # use strict; use warnings; # open file for reading open ( XML, "/path/to/file" ) || die "Can't open file $!" while ( <XML> ) { # go through line by line $_ =~ ( /<IP-(ADDRESS|NEIGHBOUR)>(.+?)<\/IP.+?/ ) my $ip = $2; # IP is the value in 2nd parenthesis }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extracting tagged data from a XML file
by herveus (Prior) on Aug 31, 2004 at 11:52 UTC | |
|
Re^2: Extracting tagged data from a XML file
by theroninwins (Friar) on Aug 31, 2004 at 09:45 UTC | |
by Random_Walk (Prior) on Aug 31, 2004 at 10:38 UTC | |
by davorg (Chancellor) on Aug 31, 2004 at 12:11 UTC |