matze77 has asked for the wisdom of the Perl Monks concerning the following question:
I want the print state in the while loop to write to the OUT Filehandle, i got a syntax error if i try this? Any Ideas where my error is? error message:#!/usr/bin/perl use strict; use File::Copy; use warnings; my $open_file= "C:/oracle/ora81/network/ADMIN/SQLNET.ORA"; my $write_file=">>C:/oracle/ora81/network/ADMIN/SQLNET.ORA"; open(IN,$open_file) || die "cannot open $open_file $!"; open(OUT,$write_file) || die "cannot create $write_file $!"; while (<IN>) { if ($_ = /^SQLNET\.AUTHENTICATION_SERVICES=\ \(NTS\)$/){ print "\#\ ^SQLNET\.AUTHENTICATION_SERVICES=\ (NTS)"; print OUT $_ "\#\ SQLNET\.AUTHENTICATION_SERVICES=\ (NTS)"; #Want to write the 2nd string print ... to OUT write handle #OUT $_ } }
String found where operator expected at ora.pl line 22, near "$_ "\#\ + SQLNET\.AUTHENTICATION_SERVICES=\ (NTS)"" (Missing operator before "\#\ SQLNET\.AUTHENTICATION_SERVICES=\ (N +TS)"?) syntax error at ora.pl line 22, near "$_ "\#\ SQLNET\.AUTHENTICATION_ +SERVICES=\ (NTS)"" Execution of ora.pl aborted due to compilation errors.
Thanks
MH
|
|---|