hi all. What a nice thread you all had a couple weeks ago under
a subject line I wrote.
Damian Conway wrote:
> NaN is dead.
....
> Except perhaps under a C<use IEEE> pragma of some kind, in which case it
> would be a proper IEEE Norweigian Blue NaN.
which merely redifines the discussion to, how does the IEEENBNaN
behave under various circumstances.
> Meanwhile, C<undef> will numerify to zero (asit always has; as we always
> intended that it still would).
If +<undef> goes to a false NaN, but +<nonexistent> goes to zero,
we keep Aaron Sherman's instance counting code examples perfectly valid.
> Unary C<+> (and other numeric contexts) will produce C<undef> when
> attempting to convert non-numeric strings.
I think of Not-a-number as a special flavor of undef.
> To check for numericity of input, you'll write:
>
> $number = +<$fh>
> until defined $number;
>
> If you ignore the definedness, the C<undef> will just promote to zero
> in numeric contexts. So you can add up your column-50 numeric fields with:
>
> $sum += +unpack("@49 A3", $_)
> while <$fh>;
>
> and have the summation ignore non-numeric fields.
hoping to see the points about mispromotion of accidental hexidecimal
addressed somewhere, doubting I will
> Or you can add the fields with:
>
> $sum += +unpack("@49 A3", $_) // die "Bad data: $_"
> while <$fh>;
>
> and handle errors with extreme prejudice.
>
> Have I missed anything?
could have put your die inside a a try just for kicks
> Damian
--
David Nicol 816.235.1187
silly ears http://www.bobdylan.com/songs/gates.html