in reply to The story of a strange line of code: pos($_) = pos($_);
let's assume that I wrote [qr/[A-Za-z0-9_\-\.]*/, "word"], instead of [qr/[A-Za-z0-9_\-\.]+/, "word"]
Couldn't that give you an infinite loop? ( Your particular set of rules and code layout is immune, but that's not always going to be the case. ) If so, reseting pos() is making things worse. An error you used to catch (with a misleading error message) now fails badly.
While it's an interesting tidbit, the need for the construct in a tokeniser is a strong indicator of an error elsewhere (as is the case here).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: The story of a strange line of code: pos($_) = pos($_);
by ambrus (Abbot) on Mar 10, 2010 at 13:15 UTC |