OK, I understand your motivations, now.
You still have numerous simpler ways to do it, such as storing your long error message in a variable (you actually had a $error variable in your original post) or doing something like this:
$ perl -e 'use diagnostics; $die_on_err=shift; 0 or print "error messa
+ge" and ($die_on_err? die $! : warn "\n" ) ' 0
error message
or, yet simpler, using a subroutine such as the one proposed by Jenda in this post: Re: Take reference and then dereference die() and warn().
|