On 12/21/18 12:28 PM, ToddAndMargo via perl6-users wrote:
On 12/21/18 12:13 PM, Timo Paulssen wrote:
Like this? > > $ p6 'my $x="11.2."; my Str $D0; my Str $D1; $x~~m{
(<:N>+) [.] >
(\d+)}; $D0 ~= $0; $D1 ~= $1; print "$D0 $D1\n";' > > 11 2 >
There's an important difference between "$D1 ~=
On 12/21/18 12:13 PM, Timo Paulssen wrote:
Like this? > > $ p6 'my $x="11.2."; my Str $D0; my Str $D1; $x~~m{ (<:N>+) [.] >
(\d+)}; $D0 ~= $0; $D1 ~= $1; print "$D0 $D1\n";' > > 11 2 >
There's an important difference between "$D1 ~= $0" and "$D1 = ~$0".
They only do the same thing if $D0 (a
> Like this? > > $ p6 'my $x="11.2."; my Str $D0; my Str $D1; $x~~m{ (<:N>+)
> [.] >
(\d+)}; $D0 ~= $0; $D1 ~= $1; print "$D0 $D1\n";' > > 11 2 >
There's an important difference between "$D1 ~= $0" and "$D1 = ~$0".
They only do the same thing if $D0 (and $D1) are empty at that point; if
they hav
On 12/21/18 11:46 AM, Timo Paulssen wrote:
On 21/12/2018 20:38, ToddAndMargo via perl6-users wrote:
$ p6 'my $x="11.2."; my Str $D0; my Str $D1; $x~~m{ (<:N>+) [.] (\d+)
}; $D0 ~$0; $D1 ~ $1; print "$D0 $D1\n";'
WARNINGS for -e:
Useless use of "~" in expression "$D1 ~ $1" in sink context (line
On 12/20/18 10:32 PM, JJ Merelo wrote:
I didn't think I needed to answer a question that can be so easily
obtained from the documentation: https://docs.perl6.org/type/Match,
which, unsurprisingly, says: "|Match| objects are the result of a
successful regex match"
That I knew. I was looking
On 21/12/2018 20:38, ToddAndMargo via perl6-users wrote:
> $ p6 'my $x="11.2."; my Str $D0; my Str $D1; $x~~m{ (<:N>+) [.] (\d+)
> }; $D0 ~$0; $D1 ~ $1; print "$D0 $D1\n";'
> WARNINGS for -e:
> Useless use of "~" in expression "$D1 ~ $1" in sink context (line 1)
> Useless use of "~" in expressio
On 12/21/18 12:58 AM, Laurent Rosenfeld via perl6-users wrote:
You're free to use a Str method call if you prefer, but using the ~ to
stringify $0 and the like works perfectly for me in perl -e ... context.
$ perl6 -e' "abc" ~~ /.(\w)./; put $0.perl; my $c = ~$0; put $c;'
Match.new(list => (),
You got the order of operations wrong.
Method calls happen before prefix operators
These are identical
+@a.so
+(@a.so)
@a.so.Numeric
@a.Bool.Numeric
+?@a
As are these
+«@a».so
+«(@a».so)
@a».so».Numeric
@a».Bool».Numeric
+«?«@a
Postfix operators also ha
> If you get a crash using it, I suspect you made another mistake somewhere.
Possibly a compiler version difference? A perl6 -v output might be
worth including.
You're free to use a Str method call if you prefer, but using the ~ to
stringify $0 and the like works perfectly for me in perl -e ... context.
$ perl6 -e' "abc" ~~ /.(\w)./; put $0.perl; my $c = ~$0; put $c;'
Match.new(list => (), made => Any, pos => 2, hash => Map.new(()), orig =>
"abc", from =>
Hi Richard,
I don't think it's a bug. In:
put +@a.so;
the @a array is coerced into a Boolean value (True) by the so method, and
the resulting Boolean value is then coerced into an integer by the +
operator.
Cheers, Laurent.
Le ven. 21 déc. 2018 à 09:28, Richard Hainsworth a
écrit :
> A snip
A snippet:
my @a = 1..10;
put +@a.so; # output 1
put so(+@a); # output True
put (+@a).so; # output True
This caught me because I used +@s.so when I tried to do something like:
# in a class with 'has Bool $.pass;'
return unless ( $!pass = +@a.so );
# fails with a Type
12 matches
Mail list logo