for my $file (keys %fhs) { # ... print $fh whatever if $file =~ /\.\.new$/; }