sub foo{ my ($hashref) = @_; for my $key (keys %{$hashref}) { do stuff; } } my %hash = (Gobs=>'many', of=>'loads', data=>'Huge'); ... foo( \%hash);