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