$ perl -le' my $list = "This is my list"; $list =~ /(.+)\s(\w+)/; my $last = $2; my $the_rest = $1; print $the_rest; print $last; ' This is my list