Various things to know about Microsoft's
cmd.exe (and how it is completely unlike any UNIX shell...):
- there are actually two separate parsing phases
- what cmd.exe does itself, i.e., cutting up the command line according to the the various separators and redirectors (i.e., < > | &, which are only significant outside of matched pairs of double quotes); and
- parsing the commandline fragment being fed to a given program into the argv parameters for that program, which is done by the C runtime invoked as part of starting that program (i.e., assuming it's a program that uses the usual C runtime; if not, then all bets are off, but perl either does or tries to emulate it, so...)
- single quotes are not significant in any way and are passed straight through by both phases
- double quotes, while they are significant to (1) are still passed through unscathed and then used by (2) to group arbitrary strings possibly containing spaces into single parameters, at which point the double quotes are stripped (except in cases where there are consecutive double quotes or preceding backslashes, but let's not go there...)
which is why, as the preceding responder noted, the single quotes are being seen by perl but the double quotes are not.
As for why it's going all of the way to 999999 in the case with single quotes, see the following sentence of perlop concerning the range .. operator
If the final value specified is not in the sequence that the magical increment would produce, the sequence goes until the next value would be longer than the final value specified.
'1999' being a six character string, the iterator value has to get to seven characters (
0000000) before the iteration will stop.
nice puzzle, btw...
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.