Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
How do your statements: No, I didn't give oct a valid hex number, I gave it an invalid octal number which could have been understood as an otherwise valid decimal number. and No, the result of oct("108") is "8" but I think it should be undef. relate to each other? 108 is an otherwise valid decimal number. You also seem to be defending, or at least sharing, the OP's ideas. And the OP wants to have a function that given decimal input, returns the decimal representation - so oct 108 (or whatever name this function has) should return 108.

If you think that oct 108 should be undefined, and not 8, do you also think that $x = "10 dogs" + "5 chickens" should result in $x being undefined, and not 15? What about

print "Please enter a number: "; my $num = <>; printf "Its square is %d.\n" => $num * $num if $num =~ /^\d+$/;
Should that print "Its square is 0.", after issueing a warning?


In reply to Re: A philosophical pondering concerning hexes by Abigail-II
in thread A philosophical pondering concerning hexes by Llew_Llaw_Gyffes

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others avoiding work at the Monastery: (4)
    As of 2018-05-24 02:34 GMT
    Find Nodes?
      Voting Booth?