Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Module for making english lists?

by didess (Sexton)
on Aug 25, 2008 at 21:52 UTC ( [id://706795]=note: print w/replies, xml ) Need Help??


in reply to Module for making english lists?

Hello, don't you think this is enough:
#!/usr/bin/perl $S = "a , b, c,d"; sub modif { my ($S) = @_; $S =~ s/(.*),/$1 and /; $S =~ s/\s*,\s*/, /g; return $S; } print "\$S=$S ==> ". modif($S) . "\n";
in case of an array (or list), join it with commas before:
@Arr = (1 , 2, 3,4); print "Array = ". modif(join(',',@Arr)) . "\n";
I don't think is worth a module! Hope it helps !

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-19 18:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found