I that case maybe you should be using the Name field as the key to your hash like this
$sql = "select * from scanner.vulnerabilities"; $sth = $dbh->prepare($sql); $sth->execute or die "SQL Error: $DBI::errstr\n"; my %ref; while (my $row = $sth ->fetchrow_hashref() ){ $ref{ $row ->{'Name'} }{'port'} = [ $row ->{'port'} ]; }
Also, this code only needs to run once so you can move it up outside the while loop.
pojIn reply to Re: MySQL to Hash Revised.
by poj
in thread MySQL to Hash Revised.
by CreationP
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |