leriksen has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; my @amounts = qw(-161.05 177.28 -16.23); my $sum = 0.0; map {$sum += $_} @amounts; print "sum = $sum\n";
Edit kudra, 2002-09-26 Removed br tags in code
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sum to Zero?
by Abigail-II (Bishop) on Sep 26, 2002 at 07:06 UTC | |
|
Re: Sum to Zero?
by helgi (Hermit) on Sep 26, 2002 at 09:22 UTC | |
|
Re: Sum to Zero?
by thinker (Parson) on Sep 26, 2002 at 08:23 UTC | |
|
Re: Sum to Zero?
by RMGir (Prior) on Sep 26, 2002 at 12:00 UTC | |
|
Re: Sum to Zero?
by physi (Friar) on Sep 26, 2002 at 07:52 UTC | |
by davorg (Chancellor) on Sep 26, 2002 at 07:55 UTC | |
by physi (Friar) on Sep 26, 2002 at 07:58 UTC | |
|
Re: Sum to Zero?
by Anonymous Monk on Sep 26, 2002 at 23:26 UTC |