$substr = " 1 "; foreach $key ( @newarray ){ if (index($key, $substr) != -1) {print "\nExist";} }