use strict; use warnings; my $list = "This is my list"; $list =~ /(.+)\s(\w+)$/; my $last = $2; my $the_rest = $1; print $the_rest . "\n"; # "This is my" print $last . "\n"; # "list";