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

Re: trailing spaces

Thread Previous
Nicholas Clark
August 20, 2003 12:08
Re: trailing spaces
Message ID:
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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About