DB<123> $str = join "","a".."j" => "abcdefghij" DB<124> $x=0;$str =~ /(\w)(?{print "match ",++$x," $1 \n"})/g match 1 a match 2 b match 3 c match 4 d match 5 e match 6 f match 7 g match 8 h match 9 i match 10 j => ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j") DB<125> $x=0; while ( $str =~ /(\w)/g ) {print "match ",++$x," $1 \n"} match 1 a match 2 b match 3 c match 4 d match 5 e match 6 f match 7 g match 8 h match 9 i match 10 j => ""