in reply to zero-length match increments pos()

I am confused as to why this does not cause an infinite loop that continuously prints "0."

It used to, in old versions of Perl. But many people would write stuff like

$_ = "aabbccddeebbff"; while( /b*/g ) { # ... }

and then be surprised that this was an infinite loop. So as Zaxo says, logic was added to make sure that with /g, even matches with zero overall length still advance the pointer.

This is documented, as per ysth's post.

Makeshifts last the longest.