Text::Conjunct - join lists of items together
print conjunct "and",
and no oranges
Text::Conjunct joins strings together with a conjunction, typically "and" or "or".
$string = conjunct $conjunction,
Returns the strings conjoined as explained above. $conjunction can be any string, which can yield nonsensical results; generally it will be "and" or "or".
conjunct "and", "one apple"
conjunct "and", "one apple", "two oranges"
one apple and two oranges
conjunct "and", "one apple", "two oranges", "three pears"
and three pears
Text::Conjunct defaults to placing a comma before the final conjunction if there are more than two connected phrases (William Strunk Jr. and E.B. White, The Elements of Style, rule 2). This is commonly called the serial comma. Many people, however, omit this comma. I am not one of them, because this seems illogical to me, and frequently results in unintended ambiguity. Compare
I'd like to thank my parents, Ayn Rand and God.
I'd like to thank my parents, Ayn Rand, and God.
and see which you think makes more sense. Commas in writing generally reflect pauses in speech, and pretty much everybody except the children of Ayn Rand and God will pause between those two terms.
But this is Perl,
where the standard dogma is that we don't do dogma.
You can set the global variable
$Text::Conjunct::SERIAL_COMMA to reflect your preference or requirements.
It defaults to 1 to reflect my personal preference,
but you can set it to zero if you would rather do it the other way.
Copyright 2004 Kevin Michael Vail
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Kevin Michael Vail <email@example.com>