in reply to RE: Silencing the grumbling from DBD::ODBC
in thread Silencing the grumbling from DBD::ODBC

I think either version of eval is equivalent as far as error trapping is concerned.

Regardless, the latter version would fail, since $sql and $dbh_g would be interpolated as the string were parsed, prior to sending the resulting argument to eval. The result would be bad Perl syntax and execution would fail. You could just put it in single-quotes instead, which would work, but you're still incurring the compilation overhead at run-time instead of putting it into a block, which is compiled along with the rest of the script.