... next if grep { /$file/ } @array_code; # not working #### ... next if grep { warn "Checking if $_ =~ /$file/"; /$file/ } @array_code; ...