I am trying to extract information from a MySQL database, which I will manipulate in perl:
use strict; use DBI; my $dbh_m= DBI->connect("dbi:mysql:Populationdb","root","LisaUni") or die("Error: $DBI::errstr"); my $Genotype = 'Genotype'.1;
This code does not cause errors, but the hash hash saves only the last row taken from the database (I had the idea to write it this way from this site ). If I print:
while(my $transvalues = $sth->fetchrow_hashref){ print "Gene: $transvalues->{Gene}\n"; print "Trans: $transvalues->{TransNo}\n"; }
Then it prints all the lines, but I need all this information to be available after closing the database connection.
I also have a related question: in my MySQL database, the string consists of, for example, 'Gene1' (Gene) '4' (TransNo). As soon as I retrieve this data from the database, as I do above, will TransNo still know which Gene is associated with? Or do I need to create some kind of hash structure hash for this?
source share