in reply to Re: trimming space from both sides of a string
in thread trimming space from both sides of a string

Why not use something like:

$string =~ s/^\s+|\s+$//g;

That should cut spaces from start and end and leave the rest.

Replies are listed 'Best First'.
Re^3: trimming space from both sides of a string
by muba (Priest) on Oct 12, 2010 at 12:42 UTC

    That's what I always use too. It does what you want (trim leading and trailing spaces), does it well, and does it without being too obscure what it is doing. I see no reasons to complicate this.