How can I check if the integer value 1 is in the array
$substr = " 1 "; foreach $key ( @newarray ){ if (index($key, $substr) != -1) {print "\nExist";} }
What is wrong ?
@newarray[n]="5 10 14 16 17 20 25 26 38 1 42 + 47 54";
Don't find because substring contains whitespace
In reply to Foreach loop by PetreAdi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |