On Mon, Oct 22, 2001 at 07:39:44PM +0100, Piers Cawley wrote:

> Yeah, but it's correct. If you extract something and get garbage then
> you're going to screw your average up. Admittedly, in 400,000 lines,
> it's unlikely to shift the average by much, but it will shift it. 

No, I'm interpreting unknown values as zero. My average is correct.
If you want to argue that I should be treating them as something
else, that's your lookout, but I'm happy with that interpretation.

What REALLY worries me is that values that seem to be numbers, but are
in fact garbage ARE going to screw my average up. I dare Perl6 to fix
that for me.

Since when is Perl a language that coddles the user and presents
the One Correct Way To Do It?

> Of course, this is assuming there's no difference between:
> 
>     $total += substr($_, 22, 2); # implicit numification
> 
>     $total += +substr($_, 22, 2); # explicit numification

If we were to decompile the first example, it would not be the same
as the second? Is there an implied operator here that I'm not seeing?
How does it behave? According to Larry, unary + forces a numeric
context, but you're saying that a numeric context can be distinguished
from a unary +

I'm confused.

> Which might be controllable via pragma.

As long as the pragma leaves:

        perl -nle '$t+=$_;END{print $t}'

alone, I'm OK. If blank lines will cause that to choke, I'm an
unhappy camper.

>         if ($val ne 'NaN') { # Ugly, gets 'round the IEEE thing

        sub notnan ($number) {
                return $number >= -Inf;
        }

> > More, someone has mentioned the %x{$_}++ feature, which IMHO, MUST
> > continue to work.
> 
> And it will, since it has nothing whatsoever to do with string
> numification. 
> 
> %x{non_existent}++ # Doesn't do numification. Autovivifies an entry in
>                    # %x, with value 'undef', which numfies to 0.

Actually, numification of undef was the entry point to this thread,
so my point remains. If notnan(undef), I'm happy, else I am become
concerned....

> Disagree.

Agree ;-)

-- 
Aaron Sherman
[EMAIL PROTECTED]             finger [EMAIL PROTECTED] for GPG info. Fingerprint:
www.ajs.com/~ajs        6DC1 F67A B9FB 2FBA D04C  619E FC35 5713 2676 CEAF
  "Write your letters in the sand for the day I'll take your hand
   In the land that our grandchildren knew." -Queen/_'39_

Reply via email to