#!/usr/bin/perl use DBI; my $dbh = DBI->connect("DBI:mysql:database=email_categorisation;host=l +ocalhost;", "root", "", {'RaiseError' => 1}); my $dbh2 = DBI->connect("DBI:mysql:database=email_categorisation;host= +localhost;", "root", "", {'RaiseError' => 1}); $query1 = "select email from emails"; $sth1 = $dbh->prepare($query1); $email_record = $sth1->execute(); $count = 0; while(($email) = $sth1->fetchrow_array()) { #print "--$email--"; $email =~/(.*\.*.*)\@(.+)/; my $user = $1 ; #$email =~/(.+)\@(.+)/; #print "$user \n"; $count ++; $query2 = "SELECT name, gender, origin from names where LOCATE(name,'" +.$user."') > 0"; #print $query."\n"; print "\n"; #sleep(6); $sth2 = $dbh2->prepare($query2); $email_record2 = $sth2->execute(); while(($name,$a,$r) = $sth2->fetchrow_array()) { print "$name ----- $a ------ $r ---- $user \n"; } } print $count; [download] the above is one.. #!/usr/bin/perl use DBI; my $dbh = DBI->connect("DBI:mysql:database=email_categorisation;host=l +ocalhost;", "root", "", {'RaiseError' => 1}); use Text::GenderFromName; $query1 = "select email from emails"; $sth1 = $dbh->prepare($query1); $email_record = $sth1->execute(); $count = 0; while(($email) = $sth1->fetchrow_array()) { #print "--$email--"; $email =~/(.*\.*.*)\@(.+)/; my $user = $1; $user=~s/[0-9]//g; #matching my $gender = &gender($user) || ''; if ($gender eq 'f') { print "$user: Female\n" } elsif ($gender eq 'm') { print "$user: Male\n" } #else { print "$user: UNSURE\n" } }