Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Module for making english lists?

by kyle (Abbot)
on Aug 25, 2008 at 21:26 UTC ( [id://706790]=note: print w/replies, xml ) Need Help??


in reply to Module for making english lists?

Yeah, pretty easy to write...

sub mkenglish { die 'arg required' if ! @_; if ( 1 == scalar @_ ) { return @_; } elsif ( 2 == scalar @_ ) { return join ' and ', @_; } else { my $last = pop @_; my $list = join ', ', @_; return "$list, and $last"; } }

You might also be interested in reading about the Serial comma.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://706790]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-03-28 13:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found