Mega Code Archive

 
Categories / Perl / Statement
 

Count 10 with while loop

#!/usr/bin/perl use warnings; use strict; # count from 1 to 10 (note the post-increment in the condition) my $n = 0; while ($n++ < 10) {     print $n, "\n"; }