I need to hide warnings within eval but the rest of the code should continue to throw warning messages. Here is what I have -
eval "\$value = $hash->{key}";
now value of $hash->{key} could be a function call, like:
$hash->{key} = "function(0.01*$another_var)";
The problem comes when $another_var
is undef
(or ""
). The script just craps out with the following message -
Argument "" isn't numeric in multiplication (*) at (eval 1381) line 1.
Any suggestions how I can avoid this? One option i was thinking was to parse the value inside parenthesis and evaluate that first, but its quite complex with the data I am dealing with.