Does this make any sense?
Here is the script again:
#!/usr/bin/perl
use strict;
use warnings;
require 'obj13-lib.pl';
my @userArray = <STDIN>;
my $sum = sumIt(@userArray);
print $sum;
And here is the library:
sub sumIt{
my $total;
$total += $_ for @_;
warn "@_ was empty, total undefined!\n" if !defined $total;
}
sub avg(@)
{
my @arr = @_;
my $arrSize = scalar(@arr);
#(last index). Double check;
my $sum = sumIt(@userArray);
return sumIt(@arr) / @sum;
}
1;
Does the library make sense?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/