my $gptr; a1(); print "v1=" . $gptr->{'v1'} . "\n"; exit(0); sub a1 { my %hsh; $gptr = \%hsh; $gptr->{'v1'} = 10; $gptr->{'v2'} = 20; }