Okay, in the (probably forlorn) hope of beating this subject to death,
let me offer a possible (post-A3/E3) position on NaN.

NaN is dead.

Except perhaps under a C<use IEEE> pragma of some kind, in which case it
would be a proper IEEE NaN.

C<undef> with numerify to zero (it always has; and we always intended
that it still would).

Unary C<+> (and other numeric contexts) will produce C<undef> when 
attempting to convert non-numeric strings.

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 it ignore non-numeric fields.

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?

Damian

Reply via email to