in reply to Problem in printing lastname and firstname

How about doing something like the code below to discard anything the user types between the first and the last names?

#!/usr/bin/perl chomp(my $full_name = <STDIN>); my @names_list = split(/ /, $full_name); my $name_elements = scalar(@names_list); print "$names_list[$#names_list], $names_list[0]\n";