Hi all,
I have a 2 questions about the internal representation of a hash or array.
Consider this piece of code:
1)
sub PassHash
{
my (%hash) = @_;
$hash{$some_key} = 'test';
...
}
PassHash(%hash);
What happens internally? Will the whole contents of the hash be copied in memory?
Or is only a reference passed? Will the $some_key element show up after PassHash?
Does the same apply to arrays?
2)
sub CreatHash
{
my %hash;
... do something with hash;
return %hash;
}
sub OtherProc
{
my %new_hash = CreateHash();
....
}
What happens internally? Will the whole contents of the hash be copied in memory to
%new_hash?
Or is only a reference passed? When is %hash garbage collected and when is %new_hash?
Does the same apply to arrays?
Thank you for you answers in advance. I need this information to optimise memory
requirements for my program.
Jeroen
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]