svend_ok has asked for the wisdom of the Perl Monks concerning the following question:
Greetings, oh wise monks
This is no doubt a shamefully elementary question, but can someone tell me what's wrong with this code (taken from http://www.opensourcetutorials.com/tutorials/Server-Side-Coding/Perl/perl-scripts-regex/page3.html)?
I'm getting the "pattern not terminated" error on the last line). The text file is just "Lorem ipsum"-type text.
my $filename = "C:\\temp\\testdata.txt"; open ( FILE, $filename) or die "Cannot open file: $!"; while ( $line = <FILE> ) { # i is case insensative # ([^>]*) match zero or more characters but not '>' $line =~ s/ying/yang/gi; push(@outLines, $line); } close FILE; open ( OUTFILE, ">$filename" ); print ( OUTFILE @outLines ); close ( OUTFILE ); ?>
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "search pattern not terminated " error
by almut (Canon) on Feb 25, 2010 at 19:00 UTC | |
by svend_ok (Initiate) on Feb 25, 2010 at 19:28 UTC | |
by AnomalousMonk (Archbishop) on Feb 25, 2010 at 23:00 UTC |