in reply to Infinite loop regex

You probably want to use the \G anchor e.g
print "[$1]" while "foo bar baz quux" =~ /\G(\w+) ?/g; __output__ [foo][bar][baz][quux]
See the perlre manpage for more info.
HTH

_________
broquaint