sub make_hash { my %hash; # Do clever stuff to fill in values in hash return \%hash; } #### my $thisDataset = make_hash(); #### sub do_stuff_to_hash { foreach (keys %{$_[0]}) { # do something with each key } } do_something_with_hash($thisDataset); #### $thisDataset{$curr_month}; #### $thisDataset->{$curr_month};