I have a line of perl like so:
perl -e '$_ = "a"; while (m/(?:\G|^)(a)/g) {print "[$1]\n";}'
but when I upgrade from 5.005 to 5.6.0, everything hangs.
How can this happen, and why was this bug installed into Perl?
Is it an attempt to punish people for using regex's styles
that are supposedly depricated or something? I would think
that most old perl code should also work on the new perl,
and, at least, any pattern match with a "g" option should not
cause an infinite loop, eh?
BTW, I just changed to this and it works on both perls:
perl -e '$_ = "a"; while (m/\G(a)/g) {print "[$1]\n";}'
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.