Count 10 with while loop : While « Statement « Perl
- Perl
- Statement
- While
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";
}
Related examples in the same category