sub before_next_stuff { # lots o stuff } MAINJOB: foreach ( @array ) { if ( $something ) { # do stuff if ( $something_1 ) { # time to move to next iteration # of the loop before_next_stuff(); # you should only include this # loop control here if you must if ( $x > $stop ) { last MAINJOB; } elsif ( $y ne $text ) { foobar(); } else { next MAINJOB; } } } if ( $something_else ) { # do some other stuff before_next_stuff(); # you should only include this # loop control here if you must if ( $x > $stop ) { last MAINJOB; } elsif ( $y ne $text ) { foobar(); } else { next MAINJOB; } } # more stuff in loop before_next_stuff(); if ( $x > $stop ) { last MAINJOB; } elsif ( $y ne $text ) { foobar(); } # no "next" necessary here }