http://www.perlmonks.org?node_id=948

while loops allow you to execute a group of statements so long as a statment still evaluates to true.
Here's a quick example;
$num=20; while($num<30){ print "num is $num\n"; $num=$num+1; } this will print out num is 20 num is 21 ... num is 29

then num is incremented to 30 which is no longer less than 30 so the code within the while statement is not executed and execution jumps to the next statement outside of the while statement.

If you think you know all about while statements learn about his less popular brother until.

Edit Wed Aug 1 07:07:10 EDT 2001 - Petruchio Changed PRE tags to CODE tags, added whitespace.

Edit Mon Dec 02:27:42 EST 2004 - Petruchio changed '$while' to 'while', because this is in our Tutorials section, and should be accurate.