Hi owen,
Please help me in resolving errors in the following script
open(INPUT,"<Test.txt");
open(OUTPUT,">new.txt");
$temp = \/user\/gowri\/remote2;
while ( <INPUT> ) {
$_ =~ s{\\/user\\/cce\\/g_tool}{$temp};
print OUTPUT $_;
}
Error:
Bareword found where operator expected at example1.pl line 5, near "$_
=~ 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
"/cce\\/g_tool"
(Missing operator before _tool?)
syntax error at example1.pl line 5, near "$_ =~ s{\\/user"
Unmatched right curly bracket at example1.pl line 5, at end of line
Execution of example1.pl aborted due to compilation errors.
-----Original Message-----
From: Owen [mailto:[email protected]]
Sent: Wednesday, April 15, 2009 1:44 PM
To: Gowri Chandra Sekhar Barla, TLS, Chennai
Cc: Perl Beginners
Subject: RE: Reg:Regular expression
>
> 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.
Looking at your numbered script above, I cannot find $str nor /iprcce/
Perhaps you need to copy and paste the program you were trying to run
rather than retype it in an unusable form?
--
Owen
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.
-----------------------------------------------------------------------------------------------------------------------
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/