$list =~ / ^(.+) # The 'rest' (Everything before last word) \b(\w+) # Last 'word' (string of contiguous word characters) \W*$ # Possible non-word characters at end of string /x;