I'm learning about Match objects today. I can't assign $/ to a variable or pass it to a method. Is this a bug, or am I just confused? I get the following results. In both cases, $/ gets stringified instead of remaining as a Match instance.

% ./perl6 -e 'if ("f" ~~ m/f/) { my Match $m = $/; }'
Type check failed
current instr.: 'parrot;Perl6Object;infix:=' pc 60 (src/ gen_builtins.pir:52)
called from Sub '_block21' pc 328 (EVAL_13:131)
called from Sub '_block11' pc 46 (EVAL_13:20)
called from Sub 'parrot;PCT;HLLCompiler;eval' pc 864 (src/PCT/ HLLCompiler.pir:498) called from Sub 'parrot;PCT;HLLCompiler;command_line' pc 1355 (src/ PCT/HLLCompiler.pir:725)
called from Sub 'parrot;Perl6;Compiler;main' pc 17077 (perl6.pir:179)

or

% ./perl6 -e 'sub foo(Match $m) { say $m; }; if ("f" ~~ m/f/) { foo ($/); }'
Parameter type check failed
current instr.: 'die' pc 13235 (src/gen_builtins.pir:8178)
called from Sub '!TYPECHECKPARAM' pc 14145 (src/gen_builtins.pir:8725)
called from Sub 'foo' pc 144 (EVAL_14:59)
called from Sub '_block43' pc 470 (EVAL_14:177)
called from Sub '_block11' pc 46 (EVAL_14:20)
called from Sub 'parrot;PCT;HLLCompiler;eval' pc 864 (src/PCT/ HLLCompiler.pir:498) called from Sub 'parrot;PCT;HLLCompiler;command_line' pc 1355 (src/ PCT/HLLCompiler.pir:725)
called from Sub 'parrot;Perl6;Compiler;main' pc 17077 (perl6.pir:179)

% ./perl6 -v
This is Rakudo Perl 6, revision 32120 built on parrot 0.8.0-devel
for darwin-thread-multi-2level.

Reply via email to