# This is our error container my %err; # Rather than "require", we use "do". This stops # the compilation warning from appearing. eval { do "some_code.pl"; die $@ if $@; }; if ($@) { eval $@; # evaluate our "error" string print $err{errno}; # print our errno print $err{message}; # print our message }