in reply to Re: Help creating a data structure out of a delimited string
in thread Help creating a data structure out of a delimited string
my @data; for my $set (split /#/, $patterns) { my @vals = split /\s+/, $set; my %hash; for my $i (0 .. $#vals) { $hash{$names[$i]} = $vals[$i]; } push @data, \%hash; }
my @data; for ( split /#/, $patterns ) { my %hash; @hash{ @names } = split; push @data, \%hash; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Help creating a data structure out of a delimited string
by raybies (Chaplain) on Dec 15, 2010 at 20:03 UTC | |
by jwkrahn (Abbot) on Dec 15, 2010 at 21:56 UTC | |
by raybies (Chaplain) on Dec 15, 2010 at 21:59 UTC | |
|
Re^3: Help creating a data structure out of a delimited string
by happy.barney (Friar) on Dec 16, 2010 at 13:24 UTC |