in reply to RE: Format a list with commas and
in thread Format a list with commas and "and"

If you don't want that comma, you can do without the cases:
sub list { join ", " => @_ [0 .. $#_ - 2], join " and " => @_ [grep {$_ >= 0} $#_ - 1, $#_] }

Abigail

Replies are listed 'Best First'.
Re^2: Format a list with commas and
by Aristotle (Chancellor) on Oct 04, 2002 at 20:40 UTC
    sub list { join(" and ", reverse grep defined && length, pop @_, join(", ", @ +_)) }

    Makeshifts last the longest.