my $n = 10; my $sum = 0; for my $num ( 1 .. $n ) { $sum += $num; } print $sum;