TOP_OF_LOOP: while (1) { # do this for (1 .. $some_big_number) { $foo = do_some_function($_); if ($foo % $_ = $some_smaller_number) { next TOP_OF_LOOP; } # do something else } } }