in reply to Splitting an array to populate hash

This is how I would implement this:
my @data = ( qq{key1~key2~key3 Value for key1, key2, key3}, qq{key4~key5~key6 Value for key4, key5, key6}, qq{key7~key8~key9 Value for key7, key8, key9} ); my %hash; for (@data) { s/\n(.*)$//; %hash = ( %hash, map {$_, $1} split(/~/, $_)); }
Also possible:
my %hash = map { my @things = split(/~|\n/, $_); my $value = pop @things; map { $_, $value } @things; } @data;

--
Jaap Karssenberg || Pardus (Larus)? <pardus@cpan.org>
>>>> Zoidberg: So many memories, so many strange fluids gushing out of patients' bodies.... <<<<