One thing I noted that seems a bit perverse (or wrong). Is how I'm printing out the numbers 08 and 09, which under perl would fail as numbers. My print routine, P looks at what it is printing for list members and automatically quotes non-numeric entities, while not quoting numbers. So is it wrong to leave out those quotes around 08 and 09? I shouldn't feel too horrible, as Scalar::Util's function "looks_like_number" also think 08/09 are numbers -- as does perl itself:
> tperl use Scalar::Util qw(looks_like_number); for my $i ("00".."10") { P "%s(%d) %s like a number", "$i", "$i", looks_like_number($i) ? "look +s":"does not look"; }' 00(0) looks like a number 01(1) looks like a number 02(2) looks like a number 03(3) looks like a number 04(4) looks like a number 05(5) looks like a number 06(6) looks like a number 07(7) looks like a number 08(8) looks like a number 09(9) looks like a number 10(10) looks like a number
So nothing about invalid octal constants from perl. ... *Ouch*, on a whim, I tried inserting a 0 before the 10, thinking my list iteration _might_ stop at 8, I.e.:
for my $i ("00".."010") {...
I got an enumeration up through 999. Another unexpected result! Or is that really what others expected?

Perhaps as a nod to sanity, using 010 (with no quotes) as an end-value did end at 8, but the entire sequence was numified (with the leading 0 missing):

0(0) looks like a number 1(1) looks like a number 2(2) looks like a number 3(3) looks like a number 4(4) looks like a number 5(5) looks like a number 6(6) looks like a number 7(7) looks like a number 8(8) looks like a number

In reply to Re: curious behavior: why does it do this? by perl-diddler
in thread curious behavior: why does it do this? by perl-diddler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.