NetWallah has asked for the wisdom of the Perl Monks concerning the following question:
(I have no control over the content of $Incoming).use strict; use Data::Dumper; my $Incoming = 'uno="one" Blah blah dos="two" * More Noise* tres="thr +ee"'; my %att= (PREEXISTING=>"val1", ANOTHER=>"Val2"); my %temp = $Incoming=~m/\W*(\w+)="([^"]+)"/ig; $att{uc $_}=$temp{$_} for keys %temp; print Dumper \%att; #--- Output -- #$VAR1 = { # 'TRES' => 'three', # 'UNO' => 'one', # 'DOS' => 'two', # 'ANOTHER' => 'Val2', # 'PREEXISTING' => 'val1' # };
Syntactic sugar causes cancer of the semicolon. --Alan Perlis
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pair-wise list access - without temp hash
by wind (Priest) on Feb 25, 2011 at 05:16 UTC | |
by NetWallah (Canon) on Feb 25, 2011 at 05:29 UTC | |
by ikegami (Patriarch) on Feb 25, 2011 at 06:15 UTC | |
by NetWallah (Canon) on Feb 26, 2011 at 06:58 UTC | |
|
Re: Pair-wise list access - without temp hash
by BrowserUk (Patriarch) on Feb 25, 2011 at 05:21 UTC |