in reply to confusion with Chomp
It removes the newline after the first assignment to $n prior to the loop, then unless the initial $n is 999, it'll step into the while(). You continue to remove the newline as each new STDIN is accepted, prior to the while() condition being checked again.
So effectively, inside the while, you chomp the input *before* the while is checked again. No chomp happens after the while, just the printing of the sum.
Does that help?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: confusion with Chomp
by Irishboy24 (Sexton) on Apr 08, 2016 at 01:15 UTC |