in reply to New Perl user - help with my homework

print "Please enter a number: \n"; my ($limit)= <STDIN>; chomp $limit; my $sum = 1; my @array = (); for (my $i=1; $i<=$limit; $i+=2) { $sum += 2 push(@array,'1') } my $average = $sum/scalar(@array); print "$average\n";

Replies are listed 'Best First'.
Re^2: New Perl user - help with my homework
by Eardrum (Initiate) on Dec 24, 2018 at 14:53 UTC
    Hey, and thank you all for your help. I appreciate it. I have edited my original message, if you could take a look, I'd much appreciate it. Thank you!