And the same with error handling:
use List::Util 'sum'; my $avg = @times ? sum(@times)/@times : "NaN";
As I just discovered w/ some help on CB, don't expect the above "NaN" to be NaN on MS. s/"NaN"/1e9999\/1e9999/ for portable (and less readable) support there.
Update: ikegami is of course right that it's a C lib problem, not OS dependent, but that does not change that there are potential NaN portability issues.
In reply to Re^2: Average Time?
by kennethk
in thread Average Time?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |