in reply to Matching up XML tags in 2 arrays
my %text1 = ( "is" => [ "1" ], "example that I just made" => [ "2" ], "I" => [ "3" ], ); my %text2 = ( "Here is" => [ "7" ], "example that I just made" => [ "8" ], ); foreach my $content (keys %text2) { next if not exists $text1{$content}; my @ids = ( (map { "text1.$_" } @{$text1{$content}}), (map { "text2.$_" } @{$text2{$content}}), ); print("\"$content\" found at ", join(', ', @ids), "\n"); }
Building the hashes is an exercise left to the user (since it's dependant on the parser you're using).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Matching up XML tags in 2 arrays
by bwgoudey (Sexton) on Jan 16, 2007 at 02:02 UTC | |
by bobf (Monsignor) on Jan 16, 2007 at 03:16 UTC |