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

Reply via email to