Thanks a lot! It worked!


----- Original Message ----- 
From: "Bob Showalter" <[EMAIL PROTECTED]>
To: "'John'" <[EMAIL PROTECTED]>; "Perl Beginners" <[EMAIL PROTECTED]>
Sent: Thursday, July 08, 2004 7:07 PM
Subject: RE: trim


> 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>
>
>
>



-- 
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