> > > First this thread tells me that "123foo" will be 123 in numeric
> > > context. Now I find myself wondering what "123indigo" evaluates
> > > to!
> >
> > It would evaluate to 123.  If "use complex" is in effect, it would
> > evaluate to 123i.  At least that's the position I'm taking at the
> > moment  ;-)
> 
> 123i unless of course we use nano prefix (postfix?), then it would be
> 0.000000123i of course. ;)

In which case "123foo" is 123e-15 (femto).

If we are going to have all these postfixes, then we would probably
want invalid ones to evaluate to NaN instead of truncating them.
We can always have a standard fn/method that strips the invalid
characters off the end if the string:


  my $string = "1.23Ki4b2XXX".
  my $a = +string; # NaN
  my $b = +$string.numeric_prefix; # 1230 + 16i
  my $c = +$string.real_prefix;    # 1230
  my $d = +$string.integer_prefix; # 1

or some such thing.


Dave.

Reply via email to