in reply to Exiting script from subs
Obviously the string 'exit' is not that desirable (and for the sake of your example), but the return code should depend on what the function does (and allow for further scope).my $result = do_task(); exit() if ($result eq 'exit'); sub do_task { ... do something... if ($somecondition) { return 'exit'; } }
|
|---|