Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am using the following code to populate a hash with a key and an array of values
How can I perform work on each of the values (i.e. maybe a join) and then print the key with its corresponding list of values?$construct{$record->[1]}{$record->[2]} = 0; foreach my $key (keys %construct) { $construct{$key} = [keys %{$construct{$key}}]; } my %TEST; while ((my $key, my $value) = each %construct) { my @values = @$value; $TEST{$key} = \@values; }
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to print a hash of arrays with the key
by blokhead (Monsignor) on Jan 15, 2003 at 19:12 UTC |