$num=20; while($num<30) { print "num is $num\n"; $num+=$num;\n } #I think you ment: $num += 1; #Though these should work also: $num++; ++$num;