I have a Perl loop that needs to return numbers in consecutive order starting from 1 until the number input, but instead I am getting the sum of all the numbers. i.e. If I input 3, I want it to print "1, 2, 3" but instead it prints "6". Here is that portion of the code:
$num_days = <STDIN>;
for (1..$num_days)
{
$num_days_string += "$_, "; #this get stashed in an array and printed later
}
Thanks in advance
$num_days = <STDIN>;
for (1..$num_days)
{
$num_days_string += "$_, "; #this get stashed in an array and printed later
}
Thanks in advance