##
s/^(.*) +([^ ]+)$/$2, $1/;
####
use strict;
my @cognome = last_name_first("leonardo Da Vincy","Raffaello da Urbino");
print join(";",@cognome);
sub last_name_first {
my@names=@_;
foreach(@names){
s/^(.*)+([^ ]+)$/$2, $1/; #$1 anything that starts is 1st name and $2=anything else after..FAIL!
#s/^(.*) +([^ ]+)$/$2, $1/; #works... space seems to do it,why?
}
return @names;
}