Your question, (especially the "can't use the chop function" bit) smells a lot like homework. Please make an attempt at solving your problem, then show us what you've tried and we'll point out why it's failing.
As a further clue, take a look at perldoc perlre and the docs for the s/// operator in perldoc perlop.
In reply to Re: removing space from beginning and end of sentence
by tirwhan
in thread removing space from beginning and end of sentence
by perlbeginner10
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |