Another TMTOWTDI, or ""Who need glob?"
UPDATE: Should be :#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11107038 use warnings; my @lines = <DATA>; @lines = map { /[^=:\s]*,[^=:\s]*/; map "$`$_$'", split /,/, $& } @lin +es while "@lines" =~ /,/; my %hash = split ' ', "@lines"; use Data::Dump 'dd'; dd \%hash; __DATA__ Prefix1=A,B:c,d value1 Prefix2=A:b,c:1,2 value2
#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11107038 use warnings; my @lines = <DATA>; @lines = map { /[^=:\s]*,[^=:\s]*/ ? map "$`$_$'", split /,/, $& : $_ +} @lines while "@lines" =~ /,/; my %hash = split ' ', "@lines"; use Data::Dump 'dd'; dd \%hash; __DATA__ Prefix1=A,B:c,d value1 Prefix2=A:b,c:1,2 value2
In reply to Re: Combinations of lists, etc
by tybalt89
in thread Combinations of lists to a hash
by tel2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |