> Aaron Sherman <[EMAIL PROTECTED]> wrote:
> while(<>) {
> $count++;
> $total += substr($_,22,2);
> }
> printf "Average: %.2f\n", $total/$count;
>
>Right now, if my expected numeric column has garbage in it on the
>400,000th line, I treat it as zero and go on, getting a meaningful
>result. If that garbage translates to NaN, then I'm going to get
>"Average: NaN" as my result? That's just freaky!
>
>
And in the spirit of hyper-operators doing the right thing when they expand
lists, perhaps garbage in this:
$product *= substr($_,22,2)
should numerify to 1.
Default numerification based on operator context. The identity value, IIRC.
NaN could be the default default, so to speak.
Philip
Disclaimer
This communication together with any attachments transmitted with it ('this E-mail')
is intended only for the use of the addressee and may contain information which is
privileged and confidential. If the reader of this E-mail is not the intended
recipient or the employee or agent responsible for delivering it to the intended
recipient you are notified that any use of this E-mail is prohibited. Addressees
should check this E-mail for viruses. The Carphone Warehouse Group PLC makes no
representations as regards the absence of viruses in this E-mail. If you have received
this E-mail in error please notify our ISe Response Team immediately by telephone on +
44 (0)20 8896 5828 or via E-mail at [EMAIL PROTECTED] Please then immediately
destroy this E-mail and any copies of it.
Please feel free to visit our website: http://www.phonehouse.com