Comma quibbling: Difference between revisions
m
→{{header|Perl}}: future-proof for 5.36, explicit :prototype
Drkameleon (talk | contribs) (updated solution for Arturo) |
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: future-proof for 5.36, explicit :prototype) |
||
Line 3,171:
=={{header|Perl}}==
{{trans|Raku}}
<syntaxhighlight lang="perl">sub comma_quibbling :prototype(@) {
return "{$_}" for
@_ < 2 ? "@_" :
Line 3,188:
<syntaxhighlight lang="perl">use 5.01;
sub comma_quibbling {
my $last = pop // '';
return '{'. (@_ ? (join ', ', @_).' and '.$last : $last).'}';
|