while( substr( $$str, $y * $WIDTH, $WIDTH ) =~ m[((.)\2*)]mg ) { ... #### sub f { "abc" } 1 while f() =~ /./g;