in reply to cheesy comparison program not working!!

Hi,
++others for the corrections and suggestions.
This is certainly not the best in terms of coding standards or algorythms, but should give you an idea as to where this could go...
#!/usr/bin/perl -w use strict; sub addition { my $sum; my(@mynumbers) = @_ ; for (@mynumbers){ $sum += $_ ; } return $sum ; } my @numlist = <STDIN> ; chomp(@numlist); my $total = addition(@numlist) ; my $average = $total/scalar(@numlist) ; print '---',"\n","Average: $average\n", '---',"\n"; for (@numlist) { if ($_ > $average) { print "$_ is greater than $average \n" ; } }
results in:
$ perl 641496.pl 1 2 65 33 49 --- Average: 30 --- 65 is greater than 30 33 is greater than 30 49 is greater than 30

Regards,
svenXY