New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong order with %% $<delim>=.* #4317
Comments
From @AlexDanielCode: Output: The order is wrong. I expected this: This problem is more obvious if you add actual delimiters (in which case it Output: This output is correct. |
From @pmichaudOn Thu, Jun 11, 2015 at 02:53:15PM -0700, Alex Jakimenko wrote:
I'm not entirely certain this is a bug, although it might be less than optimal. By using 'say' we're seeing the .gist of the resulting Match object, which in turn is using .caps . The .caps method sorts the captured parts based on the .from of each submatch. In this case, $<delim>[0] and $0[1] both have a .from of 2. Since their .from's result in a tie, the one that happens to be earlier in the capture hash ('0' in this case) ends up appearing first (since sorting is stable). I guess we can update .caps to sort based on both the .from and .to values of each submatch, although doing so will likely make .caps a fair bit slower. Pm |
The RT System itself - Status changed from 'new' to 'open' |
From @TimToadySince the sort is stable, I believe it suffices simply to sort on the .to instead of the .from. Larry |
From @jnthnOn Fri Jun 12 17:19:02 2015, larry wrote:
Seems so. Added a test in S05-capture/caps.t. |
@jnthn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#125391 (status was 'resolved')
Searchable as RT125391$
The text was updated successfully, but these errors were encountered: