in reply to Re: Re: Re: Removing backtracking from a .*? regexp
in thread Removing backtracking from a .*? regexp

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.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
Hooray!
Wanted!