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...