Chuck Tomasi wrote:
>
> I'd like to send two or more associative arrays (hashes) to a sub. It looks
> like the first one makes it but the values of the second never get passed.
> Am I doing something wrong or is there a better way to do this (I'm hoping
> you don't say by reference or I'll have to setup a lot of temporary hashes
> to pass one or two key/value pairs on second, third, and fourth args)
>
You should pass references to the hashes instead of the hashes itselfs:
E.g. with merging:
my %hash1;
my %hash2;
# now, I pass two references
my %merged = &merge( \%hash1, \%hash2 );
sub merge {
# take the references;
($hash1_ref, $hash2_ref) = @_;
# now dereference
%hash1 = %$hash1_ref;
%hash2 = %$hash2_ref;
return (%hash1, %hash2);
}
Best Wishes,
Andrea
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]