in reply to I want to find a group of pattern in a xml file
Or you could just use XML::Simple. Borrowing from toolic's example:
use strict; use warnings; use XML::Simple; my $xfile = <<EOF; <people> <person><name>Jane Doe</name><age>42</age></person> <person><name>John Doe</name><age>43</age></person> <person><name>Foo Bar</name><age>43</age></person> </people> EOF my $people = XMLin($xfile); foreach (keys %{$people->{person}}) { my $person = $people->{person}->{$_}; next if $person->{age} != 43; print "$_ is $person->{age}\n"; } __END__ John Doe is 43 Foo Bar is 43
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: I want to find a group of pattern in a xml file
by cybär (Initiate) on Sep 17, 2008 at 08:11 UTC | |
by Jenda (Abbot) on Sep 17, 2008 at 12:50 UTC |