Skip Menu |
Report information
Id: 130186
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: alex.jakimenko [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Match object inside .comb is weird (‘789’.comb(/ . {say $/} <!> /))
To: rakudobug [...] perl.org
Date: Sun, 27 Nov 2016 04:36:15 +0200
From: Aleks-Daniel Jakimenko-Aleksejev <alex.jakimenko [...] gmail.com>
Download (untitled) / with headers
text/plain 444b
Code:
dd ‘789’.comb(/ . {say $/} <!> /)'

Result:
「7」
「7」
「7」
slip()

It may seem like it is stuck on ‘7’ and does not progress at all. However, if we add parens around . we will get this:

Code:
dd ‘789’.comb(/ (.) {say $/} <!> /)

Result:
「7」
 0 => 「7」
「8」
 0 => 「8」
「9」
 0 => 「9」
slip()


I do not understand why the first snippet prints 「7」 three times.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org