1#!./perl 2 3print "1..4\n"; 4 5# very basic tests of while 6 7$x = 0; 8while ($x != 3) { 9 $x = $x + 1; 10} 11if ($x == 3) { print "ok 1\n"; } else { print "not ok 1\n";} 12 13$x = 0; 14while (1) { 15 $x = $x + 1; 16 last if $x == 3; 17} 18if ($x == 3) { print "ok 2\n"; } else { print "not ok 2\n";} 19 20$x = 0; 21while ($x != 3) { 22 $x = $x + 1; 23 next; 24 print "not "; 25} 26print "ok 3\n"; 27 28$x = 0; 29while (0) { 30 $x = 1; 31} 32if ($x == 0) { print "ok 4\n"; } else { print "not ok 4\n";} 33 34