$string = "    cat and dog    ";
$string =~ s/^\s+(.*)\s+$/$1/;

> -----Original Message-----
> From: Stephens, Wes (N-Sybase) [mailto:wes.stephens@;lmco.com] 
> Sent: Wednesday, October 30, 2002 11:44 AM
> To: ActivePerl (E-mail); Perl-Win32-Users (E-mail)
> Subject: Trimming Leading and Trailing Whitespaces
> 
> 
> Is there a string manipulation function to automatically trim 
> leading and trailing whitespaces?
> 
> For example:
> 
>      Problem:
>      $string = "   cat and dog   ";
> 
>      Objective:
>      $string = "cat and dog";
> 
> 
> Thanks,
> Wes
> 
> _______________________________________________
> Perl-Win32-Users mailing list 
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to