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 expression "$D0 ~$0" in sink context (line 1) > Use of uninitialized value of type Str in string context. > Methods .^name, .perl, .gist, or .say can be used to stringify it to > something meaningful. > in block <unit> at -e line 1 > Use of uninitialized value of type Str in string context. > Methods .^name, .perl, .gist, or .say can be used to stringify it to > something meaningful. > in block <unit> at -e line 1 > Use of uninitialized value of type Str in string context. > Methods .^name, .perl, .gist, or .say can be used to stringify it to > something meaningful. > in block <unit> at -e line 1 > Use of uninitialized value of type Str in string context. > Methods .^name, .perl, .gist, or .say can be used to stringify it to > something meaningful. > in block <unit> at -e line 1
The trouble here is that what you have coded here is "create the concatenation of $D0 and $0, then create the concatenation of $D1 and $1". The compiler tells you that just creating the concatenation and not doing anything with it (like storing it into a variable) is useless, and probably wrong. Then you get errors for using uninitialized Str, which $D0 and $D1 are in both situations (since you never assign anything to it). What you need is to put a = between $D0 and ~$0 and between $D1 and ~$1 That should work. Hope that made some sense - Timo