Hi All,
Exactly what is type "Match"?
Here I want $D0..$D3 to only be strings. And it throws a match error.
$ p6 'my $x="11.2.3.4"; my Str $D0; my Str $D1; my Str $D2; my Str $D3;
$x~~m{ (<:N>) [.] (\d+) [.] (\d+) [.] (\d+) }; $D0 = $0; $D1 = $1; $D2 =
$2; $D3 = $3; print "$D0 $D1 $D2 $D3\n";'
Type check failed in assignment to $D0; expected Str but got Match
(Match.new(from => 1, made ...)
in block <unit> at -e line 1
Here is my work around:
$ p6 'my $x="11.2.3.4"; my Str $D0; my Str $D1; my Str $D2; my Str $D3;
$x~~m{ (<:N>+) [.] (\d+) [.] (\d+) [.] (\d+) }; $D0 = $0.Str; $D1 =
$1.Str; $D2 = $2.Str; $D3 = $3.Str; print "$D0 $D1 $D2 $D3\n";'
11 2 3 4
Many thanks,
-T
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A computer without Microsoft is like
a chocolate cake without the mustard
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~