sub do_something { my $param = shift; # just add a test for success here: my $info = get_info($param) || get_info('option 1'); # more things happen do_something_else($param, $info); } sub get_info { my $param = shift; my $info; if($param eq 'option 1') { $info = 'blah'; } elsif($param eq 'option 2') { return unless # <-- test whether a failure occurred; return undef do_something_that_might_fail($param) #POINT A $info = 'foo'; } else { $info = 'bar'' } return $info; }