use strict; use warnings; my $n = <>; my $sum = 0; for my $num ( 1 .. $n ) { $sum += $num; } print $sum;