use strict; my@fred=qw/1 3 5 7 9/; my$fred= total(@fred); print"The total of \@fred is $fred \n";
print"enter some number in separate lines \n"; print"you can use Ctrl\+z stop enter \n"; my$user_total= total(<STDIN>); print"the total of those number is $user_total \n"; my@num=(0..1000); my$num= total(@num); print"the total of 1-1000 is $num\n";
sub total { my(@arg)=@_; my$total; foreach(0..$#arg) {