$DB->Sql("INSERT INTO Hosts(Host_Name,SAN,location,Country) VALUES ('$host', '$clean_data{$host}'SAN'}', '$clean_data{$host}{'location'}', '$clean_data{$host}{'country'}')"); #### die "Sql Failed" . $DB->Error( ) . "\n" if ($DB->Sql ("SELECT Host_ID FROM Hosts WHERE Host_Name='$host'")); my $rec_indx; while ($DB->FetchRow()) { my %data = $DB->DataHash(); $rec_indx = $data{"Host_ID"}; print qq(index key is $rec_indx\n); } #### for my $info (@{$clean_data{$host}{'applications'}}) { unless ($seen{@{$info}}++) { $DB->Sql("INSERT INTO Apps (App_Name,Description,Host_ID) VALUES ('$$info[0]', '$$info[11]', '$rec_indx')"); } }