( my $string= q{ ... } ) =~ s/(?=^|(\n))\n[^\S\n]+/defined $1 ? "\n" : ''/ge; #### $db->select( [ "this", "that", "theother", "COUNT(*) as things" ], join( ' ', "foo", "LEFT JOIN bar USING( id )", ), [ "? <= stamp", "stamp < ?", @exclude ? "this NOT IN ( ?? )" : (), ], "GROUP BY this, that, theother", "ORDER BY that, this", "LIMIT $size OFFSET $skip", "HAVING 1 < count(*)", ); #### $db->prepare( join ' ', "SELECT", join( ', ', "this", "that", "theother", "COUNT(*) as things", ), "FROM", join( ' ', "foo", "LEFT JOIN bar USING( id )", ), "WHERE", join( ' AND ', "? <= stamp", "stamp < ?", @exclude ? "this NOT IN ( ?? )" : (), ), "GROUP BY this, that, theother", "ORDER BY that, this", "LIMIT $size OFFSET $skip", "HAVING 1 < count(*)", );