my %one; my %two; my %three; my @hashes = (\%one, \%two, \%three); for my $hash (@hashes) { for my $key (keys %$hash) { # do something } }