in reply to Is there a way to unwind the call stack and return a value?
sub baz { my $data = "something"; # Doesn't have to be a string die($data); } sub bar { baz(); } sub foo { bar(); } #main if (!eval { foo(); 1 }) { print("Got data from deep function: $@"); }
|
|---|