my %hash; populate_hash(%hash); sub populate_hash{ my %h = @_; # Makes a COPY of the paramter %h= (k1=>'v1', k2=>'v2); # Populates the LOCAL %h, not '%hash' } #### my %hash = populate_hash( ); # Option 1: Use the Return value # Option 2: pass a REFERENCE to '%hash', like this: populate_hash(\%hash); # This requires "populate_hash" to be aware of, and use the reference, like this: sub populate_hash{ my ($href) = @_; # Makes a COPY of the reference $href= {k1=>'v1', k2=>'v2}; # Notice - using CURLY brackets, not parens. This creates a Hash ref. }