http://qs321.pair.com?node_id=58413

enoch has asked for the wisdom of the Perl Monks concerning the following question:

I am running the following code:
use strict; use OLE; my $Conn; my $RS; $Conn = CreateObject OLE "ADODB.Connection"; #Create a connection f +or MS-SQL $Conn->Open("DSN=WIN;UID=db;PWD=passwd;"); #Open the ODBC named WIN $RS = $Conn->execute("select user from accounts where user = 'test'"); if (!$RS) { my $Errors = $Conn->Errors(); my $error; foreach $error (keys %$Errors) { print $error->{Description}, "\n"; } } else { print "The username is $RS->Fields(0)->value.\n"; } $Conn->Close;
When this code runs, I get the output:

The username is OLE=HASH(0x827ea0)->Fields(0)->value.

That is, it is resolving the value of the $RS->Fields(0)->value to an OLE hash of some kind. What I want is the value of that field. I looked around on PerlMonks, and found exactly the same code snippets but no discussion on this phenomenon.
This is running on Windows2000 connecting to MS-SQL7 with ActiveState Perl.

Jeremy