aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xchallenge-192/perlboy1967/perl/ch-2.pl5
1 files changed, 3 insertions, 2 deletions
diff --git a/challenge-192/perlboy1967/perl/ch-2.pl b/challenge-192/perlboy1967/perl/ch-2.pl
index 5e9fc3e944..7f45d5e22d 100755
--- a/challenge-192/perlboy1967/perl/ch-2.pl
+++ b/challenge-192/perlboy1967/perl/ch-2.pl
@@ -46,9 +46,10 @@ sub equalDistribution {
my $sum = sum(@_);
my $n = scalar(@_);
- my $avg = $sum/$n;
- return -1 if (int($sum/$n) != $avg);
+ return -1 if ($sum % $n != 0);
+
+ my $avg = $sum/$n;
my $m = 0;
while (1) {