in reply to returning first row of SQL query

If you just want one row, there's no need to do a while-loop at all:

$sth->execute; my ($serverity, $source, $displayname) = $sth->fetchrow_array; $sth->finish; print "severity\n";

Just because the docs use fetchrow_* together with while doesn't mean you have to do that too. It's good to stick to the patterns from the documentation as long as your use case also matches that of the documentation.