On Apr 13, 8:54 am, shawnhco...@gmail.com (Shawn H Corey) wrote: > C.DeRykus wrote: > > Clear as mud? Did you say 'Hell, no'...? Go then and > > meditate on autoincrement magic, grasshopper. When > > enlightenment comes, please report back and explain it > > to us too... > > Actually, it is because string-comparison operators order strings > differently than auto-increment. > > String ordering by auto-increment: > "a" > "b" > ... > "y" > "z" > "aa" > "ab" > ... > "yy" > "yz" > "za" > "zb" > ... > > String ordering by string-comparison operators: > "a" > "aa" > "aaa" > ... > "y" > "ya" > "yaa" > ... > "yz" > "yzz" > "yzzz" > ... > "z" > "za" > "zaa" > ... > > Notice that "z" appears in very different place in each. >
Yes, you're right. But I mentioned "enlightenment" because the auto-increment algorithm itself is somewhat mysterious. And, here's the doozy for me as I tried remembering: If the final value specified is not in the sequence that the magical increment would produce, the sequence continues until the next value is longer than the final value specified. ^^^^^^ So, in the OP's 'u'..'z' example, the expansion stops at 'yz' because another increment would be 'za' which is 'longer' than the final value specified'; whereas, 'yz' isn't: 'z' 122 'aa' 97 97 ... 'yz' 121 122 ---> 'shorter' than 122 'za' 122 97 ----> 'longer' than 122 In other words, the sequencing continues until there's carry past the final 'z'. I think that's the 'long and short of it... maybe I've auto-enlightened myself.. -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/