Thanks all for your prompt responses.
I don't understand why the address has been changed between "Sa:" and "Sb:" by assigning another anonymous hash. I expected "Sb:" would be the same as "Sa:", since i was using the same var.
I changed the code a bit:
sub do_something
{
my $h = shift;
print '1. do_something(): ' . $h . "\n";
%{ $h } = ( a => 'alpha', b => 'beta' );
print '2. do_something(): ' . $h . "\n";
print Dumper( $h );
}
and it shows:
hash = HASH(0x490d30)
1. do_something(): HASH(0x490d30)
2. do_something(): HASH(0x490d30)
{
'a' => 'alpha',
'b' => 'beta'
}
{
'a' => 'alpha',
'b' => 'beta'
}
The address is not changed ... the behaviour is not consistent to me :)