I just renamed it to obj13-1.pl from script.pl

So it looks now like this:

#!/usr/bin/perl

use strict;
use warnings;

require 'obj13-lib.pl';

my @userArray = <STDIN>;

my $sum = sumIt(@userArray);

print $sum;

and the library I renamed to: obj13-lib.pl and now looks like this:


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;

When I do the following:

:~$ perl obj13-1.pl

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?




Mr. Shawn H. Corey wrote:
> Amichai Teumim wrote:
>> No it was commented out. Now it's changed. I still don't know how to use
>> it. What would a good way to test it be?
>>
>> echo 1234 | ./script.pl obviously won't do much. I wad told
>> ./obj13-1.pl <<EOD
>>
>
> What the heck is obj13-1.pl?
>
> To test your script you need a list of numbers one per line.  The
> easiest way is:
>
> $ perl script.pl
> 123
> 456
> 789
> ^D
>
> The '^D' is generated by holding the Control (sometimes labeled Ctrl)
> key and pressing the d key at the same time.
>
>

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to