A while loop repeats as long as its condition stays true.

While Counter

while_counter.pl
use strict;
use warnings;

my $limit = ;
my $count = 0;
my $total = 0;

while ($count < $limit) {
    $count = $count + 1;
    $total = $total + $count;
}

print "limit=$limit\n";
print "count=$count\n";
print "total=$total\n";
use strict;
use warnings;

my $limit = ;
my $count = 0;
my $total = 0;

while ($count < $limit) {
    $count = $count + 1;
    $total = $total + $count;
}

print "limit=$limit\n";
print "count=$count\n";
print "total=$total\n";
use strict;
use warnings;

my $limit = ;
my $count = 0;
my $total = 0;

while ($count < $limit) {
    $count = $count + 1;
    $total = $total + $count;
}

print "limit=$limit\n";
print "count=$count\n";
print "total=$total\n";
loop condition A loop condition is checked before each repetition.