Home > Archive > PERL Beginners > September 2004 > Passing hashes by reference.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Passing hashes by reference.
|
|
|
| If I call a perl module with a hash variable, like so...
pass1(\%myhash);
The hash shows up in $_[0] and the debugger thinks it is a hash.
I can even use $_[0] as a hash over in the module.
Still normal so far.
But if I do %anotherhash = $_[0], I get an undef in %anotherhash.
Insights anyone??
krf
| |
| ./Rob & 2004-09-30, 2:55 am |
|
"krf" <krf@Vega.com> wrote in message
news:pan.2004.09.30.00.31.10.861598@Vega.com...
> If I call a perl module with a hash variable, like so...
>
> pass1(\%myhash);
>
> The hash shows up in $_[0] and the debugger thinks it is a hash.
>
> I can even use $_[0] as a hash over in the module.
> Still normal so far.
>
> But if I do %anotherhash = $_[0], I get an undef in %anotherhash.
>
> Insights anyone??
>
> krf
I think you need to do:
%$anotherhash = shift;
or $foo = shift;
%anotherhash = %$foo;
|
|
|
|
|