I need to hide warnings inside eval, but the rest of the code should continue to give warning messages. Here is what I have -
eval "\$value = $hash->{key}";
now the value of $ hash → {key} can be a function call, for example:
$hash->{key} = "function(0.01*$another_var)";
The problem occurs when $another_var is undef (or "" ). The script just fights with the following message -
The argument "" is not numeric by multiplying (*) by (eval 1381) line 1.
Any suggestions how can I avoid this? One of the options that I was thinking about was to parse the value inside the brackets and evaluate it first, but its quite difficult with the data I'm dealing with.
source share