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

Re: Author separation

by cdarke (Prior)
on Jun 07, 2012 at 13:05 UTC ( [id://974932]=note: print w/replies, xml ) Need Help??


in reply to Author separation

Many ways of doing this, here is mine:
use strict; use warnings; my $author = "Cheng, Liying, Fox, Janna., and Zheng, Ying. "; $author =~ s/\.| and| //g; my %hash = split (',', $author); my @authors; for my $key (sort keys %hash) { push @authors,"$hash{$key} $key"; } $author = join(',', @authors); print "$author\n";
Gives:
Liying Cheng,Janna Fox,Ying Zheng

Log In?
Username:
Password:

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

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

    No recent polls found