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.
in reply to Re^2: A philosophical pondering concerning hexes
in thread A philosophical pondering concerning hexes
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
Should that print "Its square is 0.", after issueing a warning?
print "Please enter a number: ";
my $num = <>;
printf "Its square is %d.\n" => $num * $num if $num =~ /^\d+$/;