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