Using strict definately caused me to do a little declaration changing (a lot of my's). However, the print method you suggested doesn't seem to work. This is leading me to believe maybe it isn't getting loaded right.
As you can see, I am printing the the values for the dummyrow variables. The data looks good. It looks like the right syntax for loading into the hash, but nothing is returned (except "hashy is: ") from the print statement.
I'm new to hashes, so please don't talk to cryptic.
undef my %db_processes;
my $pp1;
my $dbh;
my $SEV1;
my $app;
my $GRP3;
my $STAT1;
my $pp0;
my @dummyrow;
my $qry;
my $sth;
$dbh = DBI->connect("dbi:ODBC:$dsn_name", "$dsn_user", "$dsn_pwd")
or quittext_opc ("Failed to connect to database $dsn_name\n",
+$app, $SEV1, $GRP3, "5051", $STAT1);
$qry = "select sid,'|',serial#,'|',status,'|',process,'|',username
+,'|' from v\$session;";
$sth = $dbh->prepare($qry);
$sth->execute();
while ( @dummyrow = $sth->fetchrow_array )
{
($pp0,$pp1) = split /:/,$dummyrow[6];
chomp $pp1;
print "the pp0 value is: $pp0 and the pp1 value is: $pp1\n";
print "$dummyrow[0] $dummyrow[2] $dummyrow[4] $dummyrow[6] $du
+mmyrow[8]\n";
$db_processes{$pp1} = {SID => $dummyrow[0],
SERIAL => $dummyrow[2],
STATUS => $dummyrow[4],
PROCESS => $dummyrow[6],
USERNAME => $dummyrow[8],
};
}
$dbh->disconnect();
while (my($key, $hashy) = each %db_processes)
{
print "hashy is: $hashy->{key}\n";
}
In the above print of hashy, I have also tried to reference the hash as $hashy->{$key} with the same results. I was thinking you might have had a typo in your reco.
Thanks for your help, Jim |