my $score = 'score SOME_WORD 3.0 3.0 3.0 3.0'; my $removed_word = $score =~ s/^(score\s\b\w+\b\s)//; # $removed_word now contains 'score' plus whatever # unknown word you removed, plus trailing single space. # $score now is left only with what comes after the removed word, # and preceding whitespace has been removed. # Now you can do whatever processing you wish. # Then to put it back together: $string = $removed_word . $score;