foreach my $key (keys %valid) { for (my $i = 0; $i < $#[valid{$key]}; $i++) { print STDERR "$key: $valid{$key}[$i]\n"; } }