"Jasbinder Singh Bali" <jsbali@gmail.com> writes:
> just wondeng why doesn't it let me put
> my $dbh=DBI->connect("dbi:Pg:dbname=dbunmask; host=192.168.0.120; port=5432;",
> "", "");
> in eval
>
> says
> Global symbol "$dbh" requires explicit package name at line <where ever dbh is
> used>
The my() variable goes out of scope when the eval {} is done. Declare
the variable outside the eval {}:
my $dbh;
eval { $dbh = connect(...) };
eval { $dbh->prepare(...:) };
-Doug