in reply to Bizarreness in ?PATTERN? and g

Sorry about the previous post, didn't read the FAQ

here it is PROPERLY FORMATTED

perl -le '$s="a1, a3 - a5\na11"; while ($i<10) { $i++; $s=~?a(\d+)?g; print $1; }'
prints 1, 10 times

perl -le '$s="a1, a3 - a5\na11"; while ($i<10) { $i++; $s=~/a(\d+)/g; print $1; }'
prints 1 3 5 11 11 1 3 5 11 11

vs.

perl -le '$s="a1, a3 - a5\na11"; $s=~?a(\d+)?g; print $1; $s=~?a(\d+)?g; print $1; $s=~?a(\d+)?g; print $1; $s=~?a(\d+)?g; print $1;'
which prints 1 3 5 11

so the CODE ??g repeated in the SOURCE seems to behave differently then while (1..4) { ??g }, ie. the CODE ??g EXECUTED multiple times in the code.

I am confused.