in reply to Problem in printing lastname and firstname

perl -e 'chomp($name=<>); $,=", ";print ((split/ /,$name)[-1,0])'