in reply to regex with multiple matches, missing first match?

...this is just a guess, but I believe that whether you quote the assignment string or not makes all the difference in the world. (Although in my tests, the interpreter choked unless I supplied quotes.)

But presuming that quotes are not necessary in some contexts, here is what could happen.

The OR operator, "|" has a higher precedence than the assignment, so the fragment "1 | 0.116" yields "1". That would account for the anomaly that you describe.

On the other hand again, I could not get your assignment instruction to run under 5.6 using the debugger interactively. So I have to reiterate the wonder about there being any output at all from your program.

...All the world looks like -well- all the world, when your hammer is Perl.
---v

  • Comment on Re: regex with multiple matches, missing first match?