in reply to DBI: pass $dbh from a sub

You have a misplaced parenthasis:

($dbh = connectdb($dwqa1,$depot,$pswd) eq -1)

Should read

($dbh = connectdb($dwqa1,$depot,$pswd)) eq -1.

Note that the use of '-1' as the failure code from a subroutine that should normally return an object is somewhat affected. Usually a subroutine that fails should simply return(). (This will return undef in a scalar context and an empty list in a list context).

If you did this you could just say:

!( $dbh = connectdb($dwqa1,$depot,$pswd) )