use strict; use warnings; ... my $source_string; # set the value of $source_string to the original string $source_string =~ /^\S+\s+\S+\s+(.+)\s+\S+\s+\S+$/; my $wanted_string = $1;