while (CONDITION) { BLOCK }
####
STATEMENT while CONDITION;
####
while (my $line = ) {
# Do something with the $line
}
####
while (defined(my $line = )) {
# Do something with the $line
}
####
$ perl -MO=Deparse -e 'while(my $line=) { print; }'
while (defined(my $line = )) {
print $_;
}
-e syntax OK
####
while (my $module = glob("*.pm")) {
print "Found a module: $module\n";
}
####
my $ok=0;
$ok=1 while my $zero = glob("0");
print $ok ? "ok\n" : "not ok\n"
####
$foo = $bar || $baz
####
my $x = 1;
die("Oh dear!") while my $foo = $x && 0;
####
my $x = 1;
die("Oh dear!") while defined(my $foo = $x && 0);