"Randy J. Ray" wrote:
>
> > # These are pretty cool...
> > foreach (@old) { @new = subst /hello/X/gi, @old;
> > s/hello/X/gi;
> > push @new, $_;
> > }
> >
> This implies that the subst keyword would *both* modify LIST in-place and
> return a complete copy of the list as a return-value. Is this correct?
No, @old wouldn't be modified because $_ is a temporary value that has
no inherent connection to @old. So modifying $_ won't change @old. THAT
code is correct...
> > foreach (@str) { print "Got it" if match /\w+/, @str;
> > print "Got it" if (/\w+/);
> > }
>
> Additionally, the match example above is not identical on each side-- the
> Perl 5 version would print "Got it" for *every* matching element of @str,
> whereas the Perl 6 version would print it just once.
But this example's broken. Sorry for the confusion. What I *meant* was:
foreach (@str) { print "Got it" if match /\w+/, @str;
if (/\w+/) { $gotit = 1 };
}
print "Got it" if $gotit;
Now if DWIM just worked for email as well... ;-)
v2 of the RFC should be out tomorrow and should make a lot more sense.
It will be posted to perl6-language-regex.
-Nate