in reply to Re^2: Modifying pos() from within (?{...})
in thread Modifying pos() from within (?{...})
I already answered in the second thread, that the $input has an extra \n at the end, and I just realized why. The funny thing is, I reached that conclusion for the wrong reason. When I did my test I didn't modify $/ and didn't call chomp, so the \n wasn't removed. You, on the other hand did have chomp, but with $/ set to undef. The chomp doc states:
When in slurp mode ($/ = undef ) or fixed-length record mode ($/ is a reference to an integer or the like; see perlvar), chomp won't remove anything.
So in my tests by forgetting to call chomp, I got the same result you had by disabling its effect, and therefore reached the correct conclusion :D
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Modifying pos() from within (?{...})
by AnomalousMonk (Archbishop) on Apr 27, 2018 at 16:31 UTC |