For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > June 2007 > Re: How to replace the "\" in "C:\myrootr\folder" with "/&qu









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: How to replace the "\" in "C:\myrootr\folder" with "/&qu
Asim Suter

2007-06-26, 10:03 pm


<sv2021@gmail.com> wrote in message
news:1182879493.083400.174080@m37g2000prh.googlegroups.com...
> Hi,
> Can someone help me. I know this should be easy but I coulnt get it
> working.
>
> I want to replace the "\" backslash character in a string e.g: my
> $test = "C:\myroot\folder"; with forward slash "/"
>
> This is what my snippet, which seems to be not doing anything....
> $test =~ s|\|/|g;
>


Replace the \ by \\ in the substitution.

As \ has special special meaning - you need to "escape" it.

Regards.
Asim Suter


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com