So this is what I have now in my 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;
return sumIt(@arr) / @arr;
}
1;
Why is
return sumIt(@arr) / @arr;
wrong syntax?
It was suggested that I have to call the sumIt function.
On 8/6/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote:
Amichai Teumim wrote:
> > I get:
> >
> > Not enough arguments for index at obj13-lib.pl line 11, near "index)"
> > Compilation failed in require at obj13-1.pl line 6.
> >
> > What is this index error?
>
> Go to line 11 in obj13-lib.pl and check its syntax.
>
>
> --
> Just my 0.00000002 million dollars worth,
> Shawn
>
> "For the things we have to learn before we can do them, we learn by doing
> them."
> Aristotle
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>