in reply to DBI Placeholders

Here's a variation which prepares only once, but does not use prepare_cached(). I am not checking the return values of any DBI functions, because I'll assume RaiseError is set on the connect. Also I'm not clear on the purpose of this subroutine, is it just to check if a comp_name exists, or did you really want to look up company names by company id numbers?:
my $comp_name = get_comp_name($hash{comp_id}); BEGIN { my $sth; sub get_comp_name { my $comp_name = shift; $sth = $dbh->prepare("select comp_name from company where comp_n +ame = ?") unless $sth; my $r_name = $sth->selectrow_array($sth, undef, $comp_name); return $r_name; } }