http://qs1969.pair.com?node_id=1176251


in reply to Re^2: Faster regex to split a string into runs of similar characters?
in thread Faster regex to split a string into runs of similar characters?

On a related note: Any ideas why this:
while( substr( $$str, $y * $WIDTH, $WIDTH ) =~ m[((.)\2*)]mg ) { ...
Works (runs to completion, produces the desired results) on 5.10.1, but silently loops forever in 5.22.0?
Looks like a bug fix. expr =~ /.../g attaches position magic to the LHS after each match, to record the current pos() for that expression. If expr is a var or similar this works well; if expr returns something new each time, the old pos magic gets lost.

This similarly loops forever:

sub f { "abc" } 1 while f() =~ /./g;

Dave.