in reply to A better way than ||
use strict; use warnings; my @weights = (1,2,7,8); my @digits = (2,3,4); my $sum; for (0..$#weights) { no warnings; $sum += $weights[$_] * $digits[$_]; } print $sum;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A better way than ||
by ysth (Canon) on Jan 01, 2006 at 05:11 UTC | |
by Aristotle (Chancellor) on Jan 01, 2006 at 15:23 UTC | |
by TedPride (Priest) on Jan 01, 2006 at 06:26 UTC | |
by ysth (Canon) on Jan 01, 2006 at 22:44 UTC |