foreach my $file2 (@file2only) { unless ( $file2 =~ /^tmp|temp|recycler|history$/ ) { print OUT $file2; } }