Tested and worked! Thanks.

The last \ is necessary.




                                                                                       
                                                   
                    "$Bill Luebkert" <[EMAIL PROTECTED]>                                     
                                                   
                    Sent by:                                   To:     
[EMAIL PROTECTED]                                               
                    [EMAIL PROTECTED]       cc:     
[EMAIL PROTECTED]                          
                    eState.com                                 Subject:     Re: 
[Perl-unix-users] Insert Problem                          
                                                                                       
                                                   
                                                                                       
                                                   
                    01/24/02 06:20 PM                                                  
                                                   
                                                                                       
                                                   
                                                                                       
                                                   




[EMAIL PROTECTED] wrote:

> Need help!
>
> I would like to insert a \ before a $ (if found) in the following string:
>
>   $x = '123456$1$2$3';
>
> Output of $x must be 12345\$1\$2\$3.
>
> How do I this?


Untested:


$x =~ s/\$/\\\$/g;        # last \ may be unnecessary


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

_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users




_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users

Reply via email to