in reply to MySQL to Hash Revised.
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.
poj
|
|---|