http://qs321.pair.com?node_id=1086407


in reply to position of first matching regex

Just set a variable once and only once with the position the first time it matches.

perl -e '$shoo=q!my name is prince!; while($shoo=~m/i/g){$rx = $+[0] +unless $rx } print $rx;
Makes
9

But like Grandfather said, read perlvar.

Celebrate Intellectual Diversity