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>




Reply via email to