in reply to Code review for magazine article?
to this:foreach my $file2 (@file2only) { unless ( ( $file2 =~ "tmp" ) or ( $file2 =~ "temp" ) or ( $file2 =~ +"recycler" ) or ( $file2 =~ "history" ) ) { print OUT $file2; } }
Im not sure if this is what you mean at all, if file2 = 'historyfile' it is matched by $file2 =~ /history/. I think you meanforeach my $file2 (@file2only) { unless ( ( $file2 =~ "tmp" ) or ( $file2 =~ "temp" ) or ( $file2 =~ "recycler" ) or ( $file2 =~ "history" ) ) { print OUT $file2; } }
orforeach my $file2 (@file2only) { unless ( ( $file2 eq "tmp" ) or ( $file2 eq "temp" ) or ( $file2 eq "recycler" ) or ( $file2 eq "history" ) ) { print OUT $file2; } }
foreach my $file2 (@file2only) { unless ( $file2 =~ /^tmp|temp|recycler|history$/ ) { print OUT $file2; } }
|
|---|