in reply to merging two hashes
While [ ... ] constructs an array, it returns a reference to the array, not the array itself. That means that $s->{aa}->{'1'} (for example) is a reference to an array. You need to dereference it.
my @a = ( @{$s->{aa}->{'1'}}, @{$s->{bb}->{'1'}}, @{$s->{cc}->{'1'}}, );
or (minimal change)
my @a = map { @$_ } ( $s->{aa}->{'1'}, $s->{bb}->{'1'}, $s->{cc}->{'1'}, );
or
my @a = map { @{$s->{$_}->{'1'}} } keys %$s;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: merging two hashes
by Roy Johnson (Monsignor) on Feb 08, 2006 at 22:20 UTC |