in reply to Range operator anomaly

Various things to know about Microsoft's cmd.exe (and how it is completely unlike any UNIX shell...): 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...

Replies are listed 'Best First'.
Re^2: Range operator anomoly
by BrowserUk (Patriarch) on Jan 15, 2012 at 12:26 UTC
    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.

    Thank you. That was the missing piece of the puzzle for me. I have no recollection of ever having read that bit of the POD.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

Re^2: Range operator anomoly
by Anonymous Monk on Jan 15, 2012 at 09:19 UTC

    Hi :)

    FWIW, I do believe BrowserUk is aware of cmd.exe quoting rules

    I am too, but for me the issue was, I stopped reading perlop too soon (in cmd.exe), I stopped a page or two after this, before the range operator in list context examples

    The range operator also works on strings, using the magical auto-increment, see below.

    Its like perlfunc, its a very very big page, and perldoc -f function cuts it down to digestible size quite nicely, but you can't do  perldoc -f ..

    For quick lookups like this I don't usually reach for perldoc.perl.org

    It is kind of refreshing to remember I haven't actually read all of the pod