in reply to improve performance
my $hashtocompare{$_}++ for (@arraytocompare); foreach my $strfile (@tempfiles) { push @newarray, $strfile unless exists $hashtocompare{$strfile}; } [download]