my %result = validate($arg1, $arg2); if ($result{success}){ # woot! we can continue # do something with $result{data} } else{ # try again send_screen_back($result{message}); }