eval { local $SIG{EVILSIG} = sub { die "EVILSIG\n" }; # ... }; die $@ if $@ and $@ ne "EVILSIG\n";