sub throw { my($message) = @_; my($package, $file, $line) = caller(0); die { file => $file, line => $line, message => $message }; } eval { throw('invalid argument'); }; if($@) { die "$@->{message} at $@->{file} line $@->{line}.\n"; }
invalid argument at ./report.pl line 104.