$sth_get_branch_list = $dbh->prepare(qq( SELECT branch FROM postgres_database WHERE tree = 'first_tree' AND branch ~ '$root.\\\\d+'; )); #### $sth_get_branch_list = $dbh->prepare(q( SELECT branch FROM postgres_database WHERE tree = 'first_tree' AND branch ~ ? || '.\\\\d+'; ));