# New Ticket Created by Moritz Lenz
# Please include the string: [perl #58306]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=58306 >
r30499
This works:
use v6;
my $str = 'foo <TMPL_VAR NAME=STUFF> <dsadf ';
if ( $str.chars > 0 ) {
if $str ~~ /('<TMPL_' .*? '>')/ {
say "yes"
} else {
say "no"
}
}
(output: yes)
However, when I change the outer 'if' to 'while', it breaks:
use v6;
my $str = 'foo <TMPL_VAR NAME=STUFF> <dsadf ';
while ( $str.chars > 0 ) {
if $str ~~ /('<TMPL_' .*? '>')/ {
say "yes"
} else {
say "no"
}
}
Lexical '$/' not found
current instr.: 'parrot;Code;ACCEPTS' pc 5567 (src/gen_builtins.pir:3702)
called from Sub '_block22' pc 110 (EVAL_13:43)
So it seems that block after a while doesn't propagate $/ properly to
its inner block, thus the match dies while assigning (or binding) to $/.
You don't the inner 'if' to reproduce this problem:
while ( $str.chars > 0 ) {
$str ~~ /('<TMPL_' .*? '>')/
}
Lexical '$/' not found
current instr.: 'parrot;Code;ACCEPTS' pc 5567 (src/gen_builtins.pir:3702)
Cheers,
Moritz
--
Moritz Lenz
http://moritz.faui2k3.org/ | http://perl-6.de/