Perl6-Doc
view release on metacpan or search on metacpan
share/Apocalypse/A05.pod view on Meta::CPAN
scanning effect of C<m//> by prepending the pattern with C<.*?>.
[Update: Where the preceding paragraphs says C<:c> read C<:p>.]
But it's vitally important to understand this fundamental change, that
C<//> is no longer a short form of C<m//>, but rather a short form of
C<rx//>. If you want to add modifiers to a C<//>, you have to turn it
into an C<rx//>, not an C<m//>. It's now I<wrong> to call C<split> like
this:
split m/.../
(That is, it's wrong unless you actually want the return value of the
pattern match to be used as the literal split delimiter.)
The old C<?...?> syntax is gone. Indeed, it has to go for us to get the
unary C<?> operator.
Old New
--- ---
?pat? m:once/pat/
share/Apocalypse/A05.pod view on Meta::CPAN
$string =~ (@array = split);
or maybe even this:
@array = split given $string;
But I think I like the OO notation better here anyway:
@array = $string.split;
In fact, split may not be a function at all. The default split might
just be a string method and use unary dot:
@array = .split;
We still have the third argument to deal with, but that's likely to be
specified like this:
@array = $string.split(limit => 3);
We could conceivably make a different method for word splitting, much
( run in 2.052 seconds using v1.01-cache-2.11-cpan-71847e10f99 )