[Pdx-pm] Hash question

Roderick A. Anderson raanders at acm.org
Fri Nov 21 16:23:12 CST 2003

New to the list and glad I found it.  Not from the Portland area (Hayden, 

I've been through the list archives but found nothing on this topic (which 
almost ended up being 'Hash-ish question').

I'm working on a web interface to a commercial application using CGI.pm,
Win32::ODBC, and a pile of other modules.  Using neat tricks I've got from
"Programming Perl", "Learning Perl", "Perl Cookbook" and almost every
other O'Reilly book on perl plus those from a few other publishers, I
solved an append of one hash to another need but was wondering if there
was a better way.  And there is one problem that is Win32::ODBC caused
that I'm looking for a solution to.

First the append hash solution.  I use the hash generated from some CGI.pm
params then query a SQL Server database and and use DataHash to returned
the row.  To append to the original hash I'm using a variation on code I
got out of "Perl Cookbook".

	%SignUpInfo = (%SignUpInfo, $db2->DataHash());

Is there a better or more efficient way to do this?

Then the Win32::ODBC issue.  When I use the above $db2->DataHash() whether 
appending or creating a new hash I end up with an empty key/value in 
the hash.

Doing a

        foreach my $key (sort keys %SignUpInfo) {
            print "$key: $SignUpInfo{$key}\n";

gets me output with one line with only the colon on it.  Is there a way to
remove this key/value combination?  I think it has to do with Win32::ODBC 
returning some kind of row identifier.

  "Open Source Software - Sometimes you get more than you paid for..."

More information about the Pdx-pm-list mailing list