That is what index is made for:
You may just want to call index directly, since it returns the location in $string of the first match.sub is_subst { my ($string, $subst) = @_; -1 != index( $string, $subst); }
After Compline,
Zaxo
In reply to Re: Testing if a string is a substring
by Zaxo
in thread Testing if a string is a substring
by monkfan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |