in reply to Trailing spaces

What if there are two non-trailing spaces together that need preserving?

Replies are listed 'Best First'.
Re: Re: Trailing spaces
by dirthurts (Hermit) on Jun 22, 2001 at 08:50 UTC
    $string =~ s/\s+$//;

    will work fine for that, the $ anchors the pattern to the end of the string. Any other spaces that aren't at the end of the string are left as is.