John wrote:
> Is there any trim function that trims the spaces before and the end
> of the string? 

There's probably a module somewhere with such a function. You can also write
one simply.

I usually use the following:

   s/^\s+//, s/\s+$// for $variable;

I like that form because you can list a bunch of variables and trim them
all.

A more traditional trim() function could be:

   sub trim { local $_ = shift; s/^\s+//, s/\s+$//; $_ }

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to