Luke Palmer writes:

> After this statement:
> 
>     $x = '345';
> 
> C<$x> is a number.

Oh.  I'd been assuming that quote marks indicated strings, and that,
while a string containing only digits could obviously be treated as a
number (as in Perl 5), it wouldn't be one without being provoked.

> I should hope it would be treated as one during multimethod dispatch.

What about:

  $x = '0345';

Is that a number?  And if so which of these is the same as?

  $x = 345;
  $x = 0345;

What about if the variable contains a line read from user input?  As a
programmer I'd expect that to be a string -- and if a user happens to
type only digits then it'd be surprising to find the variable is
considered to be of a different type.

User input comes with a trailing line-break character, which would make
it not a number.  But would it suddenly become a number after
C<chomp>ing it?  Or if the input stream was auto-chomping?

Smylers

Reply via email to