On the other hand, if you want to see whether an element of an array contains the value of $item, then you have to use the grep operator to apply the test to each element in turn:if( $var =~ /$item\t/ )
Of course if you only want to check the first element for this possibility, then you would use the first example, with something like if( $arr[0] =~ /$item\t/ ) which I think is what you really want.if( grep { /$item\t/ } @arr )
Have fun
--In reply to Re: Breaking a loop after a valid match + proper use of /t delimiter.
by grinder
in thread Breaking a loop after a valid match + proper use of /t delimiter.
by cobes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |