in reply to Trailing spaces

You're very close: $string =~ s/\s*$//; As far as I know, tr can't tell position. One space is the same as any other. Hence the s///.

HTH

Update: Oops. Forgot the quantifier.

YA Update: Abigail is correct, + is better. That's what happens when you rush to fix an "oops"....

Replies are listed 'Best First'.
Re: Trailing spaces
by Abigail (Deacon) on Jun 22, 2001 at 02:29 UTC
    Using s/\s*$// is not to be recommended, as that will always match (and hence do a substitution). Use of * means zero or more times. Use + instead.

    -- Abigail