&do_task(); exit(); sub do_task { ... do something... if ($somecondition) { return(); } }