Thanks a ton Gunnar,
How about the intermediate blanks? Is there a way to recursively
take all blanks/tabs that occur??

word=Detail Design Activity Included#

I would like to remove the blanks here..

TIA
-Ajey

On Sun, 17 Oct 2004, Gunnar Hjalmarsson wrote:

> Ajey Kulkarni wrote:
> > I would like to remove all the spaces & tabs from a variable.
>
> No, you wouldn't. You would like to remove possible whitespace from the
> beginning and end of a string.
>
> > my($word) = "   Detail Design Activity Included         ";
> >
> > $word =~ s/^\s*(\D*)\s*$/$1/;
>
> It's best done using two substitutions:
>
>      $word =~ s/^\s+//;
>      $word =~ s/\s+$//;
>
> --
> Gunnar Hjalmarsson
> Email: http://www.gunnar.cc/cgi-bin/contact.pl
>
> --
> 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