in reply to Changing the return number for "die"

If you want to do it one-off, then you can simply set $! before you call die. If you want to set it more globally, then you might try:
$SIG{__DIE__} = sub { $! = 42; die @_ };
If you ever catch errors using eval, then you might want to be a bit more careful:
$SIG{__DIE__} = sub { $! = 42 unless $^S; die @_ };
--Dave
Opinions my own; statements of fact may be in error.