I realise that it's almost 2 years since the RFC deadline, plus we're
several apocolypses past the appropriate Camel chapters.

IIRC there are 5 different variants of m//

                normal                      /g

scalar context: match from start            continue progressive match
                return true/false           return true/false

list context:   match from start            continue progressive match
                return list of captures     if captures return list of
                                            captures

                                            else return list with all matches

this confuses me enough already. But I've just about got my head round it.
(strictly, I can only remember the left column, and that I need to check the
camel for the rest. However I then needed to write a test program because
Camel III doesn't say whether list context m//g starts from the beginning
or from pos)

This is from perl5-porters, and the wrong code was in a patch I sent:

On Sun, Sep 08, 2002 at 03:57:44PM +0100, [EMAIL PROTECTED] wrote:
> Nicholas Clark <[EMAIL PROTECTED]> wrote:

> Thanks, applied as #17859.
> 
> This bit:
> -    s/^(\w+)=(true|\d+)\s*$/$1='$2'\n/;
> -    my ($k,$v) = ($1,$2);
> +    my($k, $v) = s/^(\w+)=(true|\d+)\s*$/$1='$2'\n/;
> .. caused a problem, reversed as #17860. (s/// returns success only,
> even in list mode.)

There's only 1 version of s///, but I actually find it more confusing, since
I expect the left of a s/// to work just like a m//

So would it be possible for s/// to have the same return values as m// in
perl6?

Nicholas Clark
-- 
Even better than the real thing:        http://nms-cgi.sourceforge.net/

Reply via email to