in reply to removing space from beginning and end of sentence

Do you wish to remove whitespace from the beginning and end of a sentence, line, or complete string? The implementation will be different for each of those scenarios. If from a sentence, your example text is not illustrating your problem, since " Martina is Princess " is not a complete sentence. It lacks punctuation, for one thing. Define what you mean by sentence.

chop is not selective enough about what it chops, nor is it designed to work on the beginning of a string.

During your "many times" of trying, what did you try?

I recommend reading perlfaq4, particularly the section called How do I strip blank space from the beginning and end of a string?.


Dave

  • Comment on Re: removing space from beginning and end of sentence