FreeKB - Perl (Scripting) while loop
Perl (Scripting) - while loop

A while loop will loop while a certain condition is true. For example, the following script . . .

use strict;
use warnings;

my $integer = 0;

while ($integer lt "5") {
  print "$integer is less than 5 \n";


. . . will produce the following output.

0 is less than 5 
1 is less than 5 
2 is less than 5 
3 is less than 5 
4 is less than 5


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter b1011 in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |