my @num = (); my $sum = 0; for(1..5){ my $num = int(rand(50) + 1); push(@num, $num); $sum += $num; } print join(' ' , @num), "\nThe sum is: $sum\n";