develooper Front page | perl.riscos | Postings from August 2003

Re: trailing spaces

Thread Previous
From:
Nicholas Clark
Date:
August 20, 2003 12:08
Subject:
Re: trailing spaces
Message ID:
20030820194757.T558@plum.flirble.org
On Wed, Aug 20, 2003 at 02:07:59PM +0000, Colin Foster wrote:
> Hi,                       
> 
> Is there an easy way to remove the trailing
> spaces in the string "TRAILING SPACES     "

You seem to be missing a closing quote on that.

Probably the easiest way is with a regular expression. If your string is in
$a, then

   $a =~ s/ +$//;

will strip spaces from the end.

Nicholas Clark

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About