Re: list to hash puzzle

2014-02-10 Thread Dr.Ruud
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

Re: list to hash puzzle

2014-02-09 Thread shawn wilson
Ugh, best document the hell out of that. Split with parameters, splitting a tr - I see that everywhere... On Feb 9, 2014 6:45 PM, "Bill McCormick" wrote: > On 2/9/2014 10:48 AM, Bill McCormick wrote: > >> Trying to map the array list into a hash, but loose the double quotes >> surrounding the key

Re: list to hash puzzle

2014-02-09 Thread Shawn H Corey
On Sun, 09 Feb 2014 16:29:30 -0600 Bill McCormick wrote: > On 2/9/2014 3:58 PM, Shawn H Corey wrote: > > On Sun, 09 Feb 2014 10:48:46 -0600 > > Bill McCormick wrote: > > > >> Trying to map the array list into a hash, but loose the double > >> quotes surrounding the key's value. > > > > You can c

Re: list to hash puzzle

2014-02-09 Thread Bill McCormick
On 2/9/2014 10:48 AM, Bill McCormick wrote: Trying to map the array list into a hash, but loose the double quotes surrounding the key's value. This is close, but it's not removing the quotes. Solutions? #!/usr/bin/perl -w use strict; use Data::Dumper; my @array = qw(foo1="bar1" foo2="bar2");

Re: list to hash puzzle

2014-02-09 Thread Uri Guttman
On 02/09/2014 05:29 PM, Bill McCormick wrote: On 2/9/2014 3:58 PM, Shawn H Corey wrote: On Sun, 09 Feb 2014 10:48:46 -0600 Bill McCormick wrote: Trying to map the array list into a hash, but loose the double quotes surrounding the key's value. You can convert a list to a hash directly: my

Re: list to hash puzzle

2014-02-09 Thread Andy Bach
On Sun, Feb 9, 2014 at 10:48 AM, Bill McCormick wrote: > Trying to map the array list into a hash, but loose the double quotes > surrounding the key's value. "lose" the quotes, you mean. I think the trouble is your thinking the map will create a list of strings and so the quotes will auto-magic

Re: list to hash puzzle

2014-02-09 Thread Bill McCormick
On 2/9/2014 3:58 PM, Shawn H Corey wrote: On Sun, 09 Feb 2014 10:48:46 -0600 Bill McCormick wrote: Trying to map the array list into a hash, but loose the double quotes surrounding the key's value. You can convert a list to a hash directly: my %hash = qw( foo1 bar1 foo2 bar2 ); Sure, bu

Re: list to hash puzzle

2014-02-09 Thread Shawn H Corey
On Sun, 09 Feb 2014 10:48:46 -0600 Bill McCormick wrote: > Trying to map the array list into a hash, but loose the double quotes > surrounding the key's value. You can convert a list to a hash directly: my %hash = qw( foo1 bar1 foo2 bar2 ); -- Don't stop where the ink does. Shawn

list to hash puzzle

2014-02-09 Thread Bill McCormick
Trying to map the array list into a hash, but loose the double quotes surrounding the key's value. This is close, but it's not removing the quotes. Solutions? #!/usr/bin/perl -w use strict; use Data::Dumper; my @array = qw(foo1="bar1" foo2="bar2"); print "Array:\n"; print Dumper(@array); pr