In list context, //g returns all the matches. This new modifier will only match once, but the next time, it'll start attempting to match where the last one stopped. It's like doing:
while (/pattern/g) {
my ($x, $y, $z) = ($1, $2, $3);
# ...
}
except that you can combine the regex and the assignment.
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??; | [reply] [d/l] |
Ah, now I get it. It doesn't "force scalar context" because it's returning a list, but makes it match once like /g does in scalar context.
| [reply] |