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

Re: Author separation

by cdarke (Prior)
on Jun 07, 2012 at 13:05 UTC ( #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


Comment on Re: Author separation
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2014-12-28 10:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (180 votes), past polls