in reply to Changing the return number for "die"

You may wish to consider using an internal die.
sub _die { my $err_no = shift; my @msg = @_; print STDERR join "\n",@msg; exit $err_no; }
Alternatively, replace exit $err_no; with ($! = $err_no) && (die());.

Then call _die($err_num, "This thing is dead.") when you want the alternate behavior.