OK I figured most of this out I think.
I want to create a library that contains a function which takes in an
array of numbers (random numbers). This function will then calculate the
average of these numbers, the total of all these numbers added together,
and a new array of numbers which is the other numbers divided by 2.
Then it should return a new list with that information.
Then I want to create a script which should get a list of number from
STDIN and call the library function.
I've come this far to realise that I should use this script. I'm really
new to Perl. And I'm trying to learn it big time, because I am switching
to Perl for my new System Admin job. If someone can provide me guidance
it would be greatly appreciated. I really need to understand how this works.
#!/usr/bin/perl
require 'lib.pl';
@userArray = <STDIN>;
$sum = sumIt(@userArray);
print $sum;
and then for the library:
sub sumIt(){
@functionArray = @_;
foreach $line(@functionArray){
$functionSum += $line;
}
return $functionSum;
}
The top part would go in lets say script.pl and the second library part
would go into lib.pl. This far so good right?
Thanks
Amichai
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/