[prev in list] [next in list] [prev in thread] [next in thread]
List: perl-beginners
Subject: trim (was: Re: use vs require)
From: 85.144.210.174
Date: 2009-01-24 14:35:05
Message-ID: 20090124143505.5805.qmail () lists ! develooper ! com
[Download RAW message or body]
Chas. Owens wrote:
> [trim]
> $string =~ s/^[ ]*(.*)[ ]*$/$1/;
That changes the string when not necessary.
I prefer this:
s/\s+$//, s/^\s+// for $string; # rtrim + ltrim
--
Ruud
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic