in reply to Concatenate anonymous hash ref
"." is string concatenation. Not what you want.
If you were dealing with hashes directly, you'd do
%x = ( %x, bar => "def", baz => "ghi" );
or better yet
@x{qw( bar baz )} = ( "def", "ghi" );
But you're dealing with references to hash, so you simply need to dereference first as per Dereferencing Syntax.
%$x = ( %$x, bar => "def", baz => "ghi" );
@$x{qw( bar baz )} = ( "def", "ghi" );
Update: Ah shoot! I had @x[...] where I should have had @x{...}. Fixed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Concatenate anonymous hash ref
by JavaFan (Canon) on Oct 14, 2008 at 19:11 UTC |