sub foo { # do things return (1 and (complex condition)) } while (main condition) { # do things last if foo; # do more things }