Cacialli, Doug <[EMAIL PROTECTED]> wrote: : : use Win32::ODBC; : use warnings;
The problem is that you are not using 'strict'. use strict; : my $DSN; : $DSN = "GILES RESEARCH FOR PERL"; You can combine those: my $DSN = "GILES RESEARCH FOR PERL"; : my $GILES_RESEARCH; : $GILES_RESEARCH = new Win32::ODBC("DSN=$DSN; : UID=XXX; : PWD=XXX;") or : die "Error connecting to GILES RESEARCH database" . : Win32::ODBC::Error(); : print "Establishing connection to GILES RESEARCH : database: OK \n"; : : if (! $GILES_RESEARCH->Sql ("select * from tblMain") ) : { : while ( $GILES_RESEARCH -> FetchRow() ) : { : $Row++; : print "$Row \n"; : my ( %NAMES ) = $GILES_RESEARCH->DataHash( "ID", : "FIRST_NAME", "MIDDLE_NAME", "LAST_NAME"); %NAMES is scoped to this code block (the while loop). When the block ends, %NAMES falls out of scope. Basically does nothing since %NAMES before it goes out of scope. : } : } : foreach $ID (sort keys %NAMES) This is a different %NAMES. It is a global variable that has not been declared. Since it was never used before, it is empty and the statement below doesn't get executed. : { : print "$ID => $NAMES{$ID} \n"; : } HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>