The shortest way I've found to reproduce that is:
perl -wE "say for '1' .. q['']"
Which counts to 99. It counts up until the the length of the string exceed the length of the RHS. Other characters on the RHS work too, for example for '1' .. 'aa'.
So it seems that the range iteration with strings doesn't use ordinary cmp semantics (nor one of lt/le/gt/ge), but rather something that uses string length as the primary criterion.
And I guess that kind of makes sense, otherwise "1" .. "a" would run infinitely, because the magical postincrement would produce 9 and then 10, which is still stringy less-than 'a', and then all the numbers off to infinity.
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.