Just set a variable once and only once with the position the first time it matches.
Makesperl -e '$shoo=q!my name is prince!; while($shoo=~m/i/g){$rx = $+[0] +unless $rx } print $rx;
9
But like Grandfather said, read perlvar.
Celebrate Intellectual Diversity
In reply to Re: position of first matching regex
by InfiniteSilence
in thread position of first matching regex
by techtaskers.com
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |