- or download this
sub serial {
join(', ', @_[0..$#_-1]) .
(@_>2 ? ',':'' ) .
(@_>1 ? (' and ' . $_[-1]) : $_[-1]);
}
- or download this
my @primate = qw( sifaka gibbon tarsier langur );
print "Endangered primates: ", serial(@primate), ".\n";
- or download this
# in some parent formatting, template processing module
use Template; # not actually using it in the code here
use Template::Stash;
...
(@list>2 ? ',':'' ) .
(@list>1 ? (' and ' . $list[-1]) : $list[-1]);
};
- or download this
Hey, Joe. Where you going with that
[% user.ListOfItems.serial %] in your hand?