in reply to Using map to split an array to hash key/values
Use split's 3-argument form to avoid having a broken hash when one of @array's elements is something "foo:bar:baz"@array = ('key1:value1', 'key2:value2', qw(key3:value3 key4:value4 key +5:value5)); # Hope this helps beginners to understand what qw// does... %hash = map { split /:/, $_, 2 } @array;
|
|---|