emilford has asked for the wisdom of the Perl Monks concerning the following question:
I need all of the information after the colons. The odd numbered values (label1) I want to use as a hash key and the even numbered values (label2) I want to use as the hash value. I've gotten that far with the following: my %hash = map { m!(?:\S+) : (\S+)! } @stuff_from_query;. The problem I've encountered is that the data after label1 could be duplicate, but with different values for label2. The current code stores only one value, overwritting the previous. I need to somehow incorporate a push so that the value of the hash is an anonymous array, containing all found label2 values.Row 1 label1 : item1 label2 : item1 Row 2 label1 : item2 label2 : item2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: map to hash of arrays
by ccn (Vicar) on Jul 22, 2004 at 21:03 UTC | |
by emilford (Friar) on Jul 26, 2004 at 14:12 UTC | |
by ccn (Vicar) on Jul 26, 2004 at 14:26 UTC | |
by emilford (Friar) on Jul 27, 2004 at 13:51 UTC | |
|
Re: map to hash of arrays
by rnahi (Curate) on Jul 22, 2004 at 21:26 UTC | |
|
Re: map to hash of arrays
by dpuu (Chaplain) on Jul 22, 2004 at 21:13 UTC | |
by emilford (Friar) on Jul 26, 2004 at 14:18 UTC | |
by dpuu (Chaplain) on Jul 26, 2004 at 15:22 UTC | |
by emilford (Friar) on Jul 27, 2004 at 13:53 UTC | |
by dpuu (Chaplain) on Jul 27, 2004 at 16:26 UTC | |
|