in reply to position of first matching regex
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 Section
Seekers of Perl Wisdom