use strict; use warnings; my ( $i, $j, $x, $tot ); my @exes; print "Please enter for how many values of x you will be finding the Standard Deviation.\n"; do { chomp( $i = <> ); print "\nPlease only use numbers.\n" if $i =~ m/\[1-9]/; } until ( $i !~ m/\[1-9]/ ); print "\nPlease input the values of x, one at a time.\n"; for $j ( 1 .. $i ) { do { chomp( $x = <> ); print "\nPlease only use numbers.\n" if $x =~ m/\[1-9]/; } until ( $x !~ m/\[1-9]/ ); push @exes, $x; } undef $x; for (@exes) { $x = $x + $_; } my $ave = $x / $i; for (@exes) { $tot = $tot + ( ( $_ - $ave ) ^ 2 ); } my $deviation = sqrt( $tot / $n ); print "\nThe Standard Deviation of that set of numbers is $deviation.\n";