in reply to non-greedy incremental regular expression?
Voilà:#!/usr/bin/perl use warnings; use strict; use XML::Simple; use Data::Dumper; my $s = '<foo><color>red</color><color>white</color><color>blue</color +></foo>'; print $s,"\n"; my $parsed = XMLin($s); print Dumper($parsed);
In english, $parsed is a hash containing one key, 'color', whose value is a reference to an array containing the values 'red', 'white', and 'blue'. E.g.<foo><color>red</color><color>white</color><color>blue</color></foo> $VAR1 = { 'color' => [ 'red', 'white', 'blue' ] };
print $_,"\n" for ( @{$parsed->{color}} )
|
|---|