foreach my $k1 (keys %$h1) { my @fields = split /,/, $h1->{$k1}; ... }