my $file="test_html"; my @file_lkp=("file1","file2"); for (my $i=0;$i<=$#file_lkp;$i++) { delete $file_lkp[$i] if ($file eq $file_lkp[$i]); }