that whole seen thing i was doing was uneeded as I only get one row, and it was obfuscating all the real issues. I took that out (which makes the code less robust as it only handles one row at a time, but that's all i need) and now it works. here the fixed code:
my %newhash; while ( my $myRef = $test->fetchrow_hashref ) { foreach my $key ( keys %$myRef ) { next if ( $key eq "TRANS_ID" ); my @tryit = split ",", $myRef->{$key}; my $name; foreach my $number ( @tryit ) { $name = $dbh->selectrow_array("SELECT PRODUCT +FROM SC_PRODUCT WHERE PRODUCT_ID = $number"); push @{$newhash{$name}}, $key; } } } foreach my $key ( keys %newhash ) { print "$key : @{$newhash{$key}}\n"; }
-- I'm a solipsist, and so is everyone else. (think about it)
In reply to Re: (SOLVED : ) )reversing a hash -- printing it
by jptxs
in thread reversing a hash -- printing it
by jptxs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |