#!usr/bin/perl use strict; use warnings; use DBI; my $adres; $adres = ''; print $adres; my $db = DBI->connect("DBI:Pg:dbname=bigone; port=5432", 'postgres', '',{ RaiseError => 1, AutoCommit => 0 }) or die "kon de database niet openen!"; my ($rowref, $ff, @bigmail); my $st=$db->prepare("SELECT email FROM bigone WHERE email!=''"); $st->execute(); while($rowref= $st->fetchrow_hashref){ $bigmail[$ff]= $rowref->{'email'}; $ff++; } my $zz; my $fg = @bigmail; my $pl=0; my $ecode; for (my $i=0; $i<$fg; $i++){ $ecode= $bigmail[$pl]; $pl++; if ($adres=~ /<$ecode>/){ $zz=$ecode; } } print $zz; my $relcode; $st=$db->prepare("SELECT relcode FROM bigone WHERE email = $zz "); $st->execute(); while($rowref= $st->fetchrow_hashref){ $relcode = $rowref->{'email'}; } print $relcode; $db->disconnect;