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 }