in reply to Refusal to Run
Wow, that is one messy chunk of code you have. A long time ago, Ovid wrote this gem: Clean your room. Please consider using tools such as perltidy to make your code more readable ... for others. Here is what your code looks like after i ran it through perltidy (i'm using the code you orginally posted as saved by betterworld):
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 S +tandard 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";
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Refusal to Run
by Andrew_Levenson (Hermit) on Aug 03, 2006 at 01:01 UTC |