in reply to Re: New regex modifier!
in thread New regex modifier!

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:??;

Replies are listed 'Best First'.
Re: Re: Re: New regex modifier!
by John M. Dlugosz (Monsignor) on Sep 12, 2001 at 04:10 UTC
    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.