in reply to Resetting pos() within a RegEx?
>perl -le"$|=1; ($_='abc') =~ s/\G(.)/print(pos(),' ',$1); pos()=0/eg" 0 a 1 b 2 c [download]