The stupid question is the question not asked | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Because if $x is an object, then your regex won't work. (Nevermind that it won't work for reals or negative numbers.) A stringification method (which your regex assumes) isn't reliable, because I could write a stringification method to output the number in hexidecimal, Base64, or as a roman numeral (see below) but as far as Perl was concerned, it could still operate just like a number):
If I add a few more numeric operators (it's an incomplete example), Perl can treat it just like a number, except that it outputs a roman numeral in string context. There are cases where I would like to require a value to be number, but I would like to give the user of a module the ability to use a 'number-like' object rather than a number. In reply to Re: I don't understand.
by rrwo
|
|