Perl while Loop
The Perl while loop is used to iterate the part of program or statements many times.
In while loop, condition is given before the statement. When loop execution starts, it first checks whether the condition is true or false. If condition is true,loop executes. If condition is false, the loop terminates out of the loop.
Syntax of while loop in C language
The syntax of while loop in Perl language is given below:
Flowchart of while loop in Perl
Perl while loop Example
1 2 3 4 5 6 7 8 9 10
Perl Nested while Loop Example
In nested while loop, one while loop is used inside another while loop. The inner while loop is executed completely while outer loop is executed once.
1 1 1 2 1 3 2 1 2 2 2 3 3 1 3 2 3 3
Perl Infinite while Loop Example
To create infinite while loop, pass true as the test condition. Press ctrl + c to stop the loop execution.
Infinitive While Loop Infinitive While Loop Infinitive While Loop Infinitive While Loop Infinitive While Loop ctrl+c