"Tirthankar C. Patnaik" wrote:
> 
> This might seem trivial, but it has me stumped.
> 
> The variance of numbers 0..20 is 38.5.
> Then why does Math:NumberCruncher show it as 36.6667?
> 
> Here's a sample prog, and it's output. Here test04.dat is a file that has
> numbers 0 to 20, on separate lines.
> #-------------------start----------------
> #!/usr/bin/perl -w
> use Math::NumberCruncher;
> # Program  to test Math::NumberCruncher
> 
> # Get a file from STDIN, print the variance, and the std. deviation.
> 
> @array = <>;
> map {chomp} @array;


In addition to Nick's helpful response I would like to point out that
using map() in a void context is frowned upon and is in fact not
required here because chomp() works with arrays or scalars.

my @array = <>;
chomp @array;

Or it can be written on one line like this:

chomp( my @array = <> );



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to