s/^\s+//; s/\s+$//; works better than s/^\s*//; s/\s*$//;.
In reply to Re^4: trimming space from both sides of a string by jwkrahn in thread trimming space from both sides of a string by szabgab