http://www.perlmonks.org?node_id=974932


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