my $thing_ok = eval { do_something(); 1; }; if (! $thing_ok) { # code in eval failed, so return was undef if ($@ =~ /bad parameter/) { # if the die statement died because of a bad param, warn the user # otherwise carry on silently warn $@; } }