I am new to perl and need help. How do you write a script to add the sum and find out the average and print out the five largest number in the array.
here is my array and here my script can some tell me what am i doing wrong thanks:
#to get the total
@a = ( 10 .. 16 );
$total = 0;
for ( $i = 0; $i < @a; ++$i ) {
total += $a[ $i ];
}
print "$total\n";
here is my array and here my script can some tell me what am i doing wrong thanks:
#to get the total
@a = ( 10 .. 16 );
$total = 0;
for ( $i = 0; $i < @a; ++$i ) {
total += $a[ $i ];
}
print "$total\n";