# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #125598] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=125598 >
<lucasb> m: my $x = 'a1'; $x ~~ s/(\d+)/<$0>/; say $x <camelia> rakudo-moar 58a5ed: OUTPUT«a<1>» <lucasb> m: for 1 { my $x = 'a1'; $x ~~ s/(\d+)/<$0>/; say $x } <camelia> rakudo-moar 58a5ed: OUTPUT«Use of Nil in string context in code at /tmp/SOTPBUyxHF:1a<>» * masak submits rakudobug <masak> lucasb: clearly that should work. thanks for finding it. <masak> m: my $s = "OH 819"; $s ~~ s:g/(\d)/{chr(64 + $0)}/; say $s <camelia> rakudo-moar 58a5ed: OUTPUT«OH HAI» <masak> m: my $s = "OH 819"; for $s { s:g/(\d)/{chr(64 + $0)}/; .say } <camelia> rakudo-moar 58a5ed: OUTPUT«Use of Nil in numeric context in block at /tmp/4I0l1xSFeV:1Use of Nil in numeric context in block at /tmp/4I0l1xSFeV:1Use of Nil in numeric context in block at /tmp/4I0l1xSFeV:1OH @@@» So, two cases of the same code, with and without a surrounding for loop block. All these match, but in the presence of the for loop, $/ is Nil instead of the appropriate match object.