use Fatal; import Fatal 'foo'; sub foo { my $test = rand; return $test if $test > .5; } my $test = foo(); print $test; #### Can't foo(), $! is "No such file or directory" at (eval 1) line 3 main::__ANON__() called at p.pl line 10