Hi .

 

Please help me in resolving errors in the following script

 

1.open(INPUT,"<Test.txt");

2.open(OUTPUT,">new.txt");

3.$temp = \/user\/gowri\/rem2;

4.while ( <INPUT> ) {

5.$_ =~ s{\\/user\\/cce\\/dbg_tool}{$temp};

6.print OUTPUT $_;

7.}

 

Errors: 

Bareword found where operator expected at example1.pl line 5, near "$str
=~ s{\\/user"

  (Might be a runaway multi-line // string starting on line 3)

            (Missing operator before user?)

Backslash found where operator expected at example1.pl line 5, near
"user\"

Bareword found where operator expected at example1.pl line 5, near
"/iprcce\\/dbg_tool"

            (Missing operator before dbg_tool?)

syntax error at example1.pl line 5, near "$str =~ s{\\/user"

Unmatched right curly bracket at example1.pl line 5, at end of line

Execution of example1.pl aborted due to compilation errors.

 

________________________________

From: Emen Zhao [mailto:emenzhaow...@gmail.com] 
Sent: Wednesday, April 15, 2009 12:27 PM
To: Gowri Chandra Sekhar Barla, TLS, Chennai
Cc: Beginners List
Subject: Re: Reg:Regular expression

 

>> I need to replace \/user\/cce\/g_tool with the variable $temp where

>> $temp=\/user\ /gowri\/rem2

$string =~ s{\\/user\\/cce\\/g_tool}{$temp}

HTH,

Thanks,
--Emen



DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended 
for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. 
Any views or opinions presented in 
this email are solely those of the author and may not necessarily reflect the 
opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, 
distribution and / or publication of 
this message without the prior written consent of the author of this e-mail is 
strictly prohibited. If you have
received this email in error please delete it and notify the sender 
immediately. Before opening any mail and 
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------

Reply via email to