my %Test_hash; ... sub xyz { my ($tgs) = @_; $Test_hash{$tgs} = {a => 1, b => 2}; ... } ...