sub sqlSingleRow( $sql, @placeholders ) { my $sth = $dbh->prepare( $sql ); $sth->execute(@placeholders); # Do you really get only ever a single row back? my (@r)=$c->fetchrow(); $c->finish(); return @r; } #### my $sql_cat = <<'SQL'; select ref_categorie from categorie_libelle_langue , libelle , langue from ref_categorie where libelle.libelle = ? AND categorie_libelle_langue.ref_libelle = libelle.id_libelle AND categorie_libelle_langue.ref_langue = langue.id_langue AND langue.key = ? SQL my ($cat) = sqlSingleRow($sql_cat, $category, $lang );