In Control flow§
See primary documentation in context for while, until.
The while statement executes the block as long as its condition is true. So
my $x = 1; while $x < 4 { print $x++; } print "\n"; # OUTPUT: «123»
Similarly, the until statement executes the block as long as the expression is false.
my $x = 1; until $x > 3 { print $x++; } print "\n"; # OUTPUT: «123»
The condition for while or until can be parenthesized, but there must be a space between the keyword and the opening parenthesis of the condition.
Both while and until can be used as statement modifiers. E. g.
my $x = 42; $x-- while $x > 12
Also see repeat/while and repeat/until below.
All these forms may produce a return value the same way loop does.