my $sth2 = $dbh->prepare_cached("select d_id, c_id from d where d_id = ?"); $sth2->execute( $did2 ); # And since you need less clutter on the monitor (my $sth2 = $dbh->prepare_cached(<<"")) -> execute ($did2); select d_id, c_id from d where d_id = ? # line above intentionally left blank