note
Abigail-II
How do your statements: <em>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.</em> and
<em>No, the result of oct("108") is "8" but I think it should be undef.</em> 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 <tt>oct 108</tt> (or whatever name this function has) should return <tt>108</tt>.
<p>
If you think that <tt>oct 108</tt> should be undefined, and not 8, do you also think that <tt>$x = "10 dogs" + "5 chickens"</tt> should result in <tt>$x</tt> being undefined, and not 15? What about
<code>
print "Please enter a number: ";
my $num = <>;
printf "Its square is %d.\n" => $num * $num if $num =~ /^\d+$/;
</code>
Should that print "Its square is 0.", after issueing a warning?
<p>
Abigail
368936
369339