ok so i want to ask for a input and after the user inputs a word the program than goes threw every index in the array of words. if the word is not in the array than print word is not in array. if it is in array than print it is in array. im working on a program that requires this algorithm/protocol but i seem to have a problem matching a input with a initialized value in a array. improvement in code or help with this problem of my would be nice i been struggling with it for about a week and cant seem to find how to make it work. how would i macth a string that is in array. thanks for the help in advanced.my $word; my @wrds; my $w; my $tries=0; while($tries!=2){ print "enter a word:"; $word=<STDIN>; chop $word; while($word != @wrds[$w]){ $w++; if($word = @wrds[$w]){print "found MACTH!!";} } $tries++; }
In reply to macthing a word a in array of words by zarlag
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |