use warnings; # THIS WOULD HAVE SAVED US A LOT OF TROUBLE!!!
$|=1; # So that the output isn't buffered

# Here we assign some numbers to variables
$a=5;
$b=6;
$c=7;

# We copy these variables into an array
@nums = ($a,$b,$c); # DON'T FORGET THE PARENTHESIS!!!

# We loop over the array and double each element
foreach $number (@nums){
  $number = $number * 2; # IT SHOULD BE * 2 INSTEAD OF x 2 !!!
}

# We loop over each element of the array and sum them up
$sum = 0; # WE SHOULD INITIALIZE THIS VARIABLE OR ELSE WE GET WARNINGS!!!
foreach $n (@nums){ # OOOPS! TYPO! IT'S @nums NOT @numbs !!!
  $sum = $sum + $n;
}

# To get the mean we devide the sum by the number of elements
$elements = $#nums + 1;
$mean = $sum / $elements;

# And finally we return the result
print "The mean of doubled values is $mean";

