Home  |  Linux  | Mysql  | PHP  | XML
From:Gurunandan R. Bhat Date:Wed Jul  1 01:20:45 2009
Subject:Re: Substitution question
Are you sure that your substitution works? 
With the pattern you have quoted, you should be getting a "Search
pattern not terminated" error.

To answer your other question, patterns to search must be enclosed
inside '/'s (forward slashes). 
You can change pattern delimiters then you must precede them with an
'm'. For example to use the '|' character as a patter delimiter write it
as: m|<pattern>|

In any case why do you need to do this? Do you want to convert a Windows
File path into a Unix File path? If so, there might better ways to do
it. If you give a little background, some one here might be a able to
suggest a cleaner solution

HTH
 



On Wed, 2009-07-01 at 09:56 +0530, sanket vaidya wrote:

> Hi all,
> 
>  
> 
> As a part of one program I need to get the current working directory. So I
> get this using cwd(). I want to replace forward slash (/) by backslash (\)
> in the path which I get because I work on windows.
> 
>  
> 
> Kindly look at the code below:
> 
>  
> 
> use warnings;
> 
> use strict;
> 
> use Cwd;
> 
>  
> 
> my $current_path = cwd();
> 
> print "$current_path";
> 
>  
> 
> $current_path =~ s|/|\|;
> 
> print "$current_path";
> 
>  
> 
> When I run this I get the below error:
> 
> Substitution replacement not terminated at line 8.
> 
>  
> 
> However if I replace 's|/|\|' with 's////\/' it works. Can anyone tell me
> why this happens & how to overcome it?
> 
>  
> 
> Thanks & Regards,
> 
> Sanket Vaidya
> 
> 
> _____________________________________________________________________ 
> 
> This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at netadmin@patni.com and delete this mail.
> _____________________________________________________________________

Navigate in group perl.beginners at sever nntp.perl.org
Previous Next


Your recent visits
Re: [PHP-DB] Storing images
RE: [PHP-WIN] What about php 5.3 and printers or PHP_PRINTER.DLL ?
Re: [PHP-WIN] What about php 5.3 and printers or PHP_PRINTER.DLL ?
Re: [PHP] generally, where in cPanel can one set the default page to load?


  
© No Copyright
You are free to use Anything
Site Maintained by Zareef Ahmed
Powered By PHP Consultants