No meditation necessary.
print 'Found it' if $s =~ /$thing/; print 'Found it' if 1+index( $s, $thing );
Both work. The latter is marginally quicker under most circumstances, but as you can see it is notationally more complex.
If you find the additional complexity intimidating, or don't need the (very) marginal additional performance, stick with the former.
In reply to Re: Re: Re: Re: Removing backtracking from a .*? regexp
by BrowserUk
in thread Removing backtracking from a .*? regexp
by grinder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |