Avox has asked for the wisdom of the Perl Monks concerning the following question:
I get an error on the line marked problem. Can anyone explain my error? Many thanks in advance.use Class::Struct; struct MyStruct => { hash1 => '%', }; #fill the struct's hash with some data my $test = MyStruct->new( hash1=>{one=>onesdata} ); use_hash(\$test); while(($key,$val) = each %{$test->hash1}){ print "$key=$val\n"; } sub use_hash{ my $ref = shift; #obtain the passed in reference $$ref->hash1{two} = 'twosdata'; #PROBLEM }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: passing object references into subs
by dbp (Pilgrim) on Feb 03, 2003 at 18:50 UTC | |
by ihb (Deacon) on Feb 04, 2003 at 17:30 UTC | |
by Avox (Sexton) on Feb 03, 2003 at 19:51 UTC |