Because this is a common problem (and _has_ been answered here before) i can tell that there is a very efficient way to do it (probably the most efficient one of the less complicated):
s/^\s+//; s/\s+$//;
See perlop and perlre.
--In reply to Re: Strip leading and trailing blanks
by fruiture
in thread Strip leading and trailing blanks
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |