Thanks for the replying.

I have another question, if I have a string like 
$a = "this is a (test)";

How can I change it to 
$a = "this_is_a_test";

How can I remove ()?

Thanks

Lixin


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
$Bill Luebkert
Sent: Wednesday, March 31, 2004 8:27 PM
To: [EMAIL PROTECTED]
Subject: Re: regular expression question

Wagner, David --- Senior Programmer Analyst --- WGO wrote:

Hey guys - what's with the HTML ?

> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of
> [EMAIL PROTECTED]
> Sent: Wednesday, March 31, 2004 16:49
> To: [EMAIL PROTECTED]
> Subject: regular expression question
> 
> I have a $a which
> 
>  
> 
> $a = "this is a test";
> 
>  
> 
> How can I change $a like:
> 
>  
> 
> $a = "this_is_a_test";
> 
>  
> 
>     No problem using $a, but if I were you, I would not.  In the Perl
> sort $a, $b are the default variables to use and I would stay away if I
> were you.
> 
>  
> 
>     That said,
> 
>     $a =~ s/ /_/g;

You could also use tr (slightly faster) :

        $a =~ tr/ /_/;

-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic
http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

_______________________________________________
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