in reply to Re^5: Perl CGI and SQL statements
in thread Perl CGI and SQL statements

my $db = new Win32::ODBC('$DSN');

The declaration of $db is too low. The variable is being declared in an if check and it's being referenced in an outer scope. Declare $db higher up in a block where it's visible to both the case where you assign it and where you reference it. The outer scope would work, that's where you've defined the $cgi variable.

Hazah! I'm Employed!