use strict; use warnings; use Statistics::Descriptive; my @temp=qw/26 25 23 23 26 25 24 26 28 27 26 23 28 26 25 27 27 23 24 25/; my $stat = Statistics::Descriptive::Full->new(); $stat->add_data(\@temp); my $mean = $stat->mean();#平均值 my $variance = $stat->variance();#方差 my $num = $stat->count();#data的数目 my $standard_deviation=$stat->standard_deviation();#标准差 my $sum=$stat->sum();#求和 my $min=$stat->min();#最小值 my $mindex=$stat->mindex();#最小值的index my $max=$stat->max();#最大值 my $maxdex=$stat->maxdex();#最大值的index my $range=$stat->sample_range();#最小值到最大值 print "Number of Values = $num\n","Mean = $mean\n","Variance = $variance\n","standard_deviation = $standard_deviation\n","sum =$sum\n","min =$min\n","mindex=$mindex\n","max=$max\n","maxdex=$maxdex\n","range=$range\n";
C:\Windows\system32\cmd.exe /c perl "C:\Users\GRC\Desktop\a.pl" Number of Values = 20 Mean = 25.35 Variance = 2.66052631578944 standard_deviation = 1.63111198750712 sum =507 min =23 mindex=17 max=28 maxdex=12 range=5 Hit any key to close this window...
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。