On 2014-02-09 17:48, Bill McCormick wrote:

Trying to map the array list into a hash, but loose the double quotes
surrounding the key's value.

Or do str-to-hash:

perl -Mstrict -MData::Dumper -wE'

  my $str = q(foo1="bar1" foo2="bar2");

  my $re_kv = qr/\s*(\S+)\s*=\s*"([^"]*)"/;

  my %hash = $str =~ /$re_kv/g;

  say Dumper(\%hash);
'

$VAR1 = {
          'foo1' => 'bar1',
          'foo2' => 'bar2'
        };

--
Ruud


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to