in reply to passing object references into subs

Ok. Two problems.

First of all, $test is already a reference, so you don't need to pass a reference to the reference to use_hash. If, for some reason, this is what you intended, you're going to need to dereference $ref twice in use_hash. Otherwise change

use_hash(\$test);
to
use_hash($test);

Secondly, assuming you've made the change above, change line 19 to:

%{$ref->hash1}->{'two'} = 'twosdata';
If you haven't made the change above, you'll have to nest a dereference of $ref into this statement, like so:
%{$$ref->hash1}->{'two'} = 'twosdata';

Replies are listed 'Best First'.
Re: Re: passing object references into subs
by ihb (Deacon) on Feb 04, 2003 at 17:30 UTC
Re: Re: passing object references into subs
by Avox (Sexton) on Feb 03, 2003 at 19:51 UTC
    ah! dbp++! I did not realize test was already a reference, although I guess that makes sense. I understand how references work, but get hung up on the perl syntax. Many thanks dbp!