in reply to Any tips on this?
Well you need a while loop indeed (or rather, a while loop is the obvious way to do it). Just write while instead of if, and do think about changing the value of $initial_number (maybe change its name) to give it the value of $new_number at the end of the loop. There's no else with a while loop.
And since this is very basic perl, you may want to read perlintro
|
|---|