sub get_loc { chomp $_[0]; my $dbh = DBI->connect("DBI:mysql:tracker:12.34.56.78", 'myuser', 'mypassword', {RaiseError => 1}); my $a = $dbh->selectall_arrayref(q/SELECT location FROM servers WHERE name=? LIMIT 1/, undef, $_[0]); $dbh->disconnect; return $a->[0][0]; }