Hi,

The code below opens a file and writes the contents to a temporary file. I need 
to do a search and replace of certain matches in the files and I thought I 
might be able to use regular
expressions.
Being new to perl and now trying expressions has almost put me over the edge.

When I run the below code I get this error:

Global symbol “output” requires explicit package name at filename.pl line 18....

I’m not sure whats wrong by the error.

#!/usr/local/bin/perl
use strict ;

my $ofile = "file.out";
my $ifile = "file.in";

open(INPUT, $ifile) or die "Can't open input file: $ifile ($!)" ;
        my @match_lines = <INPUT>;
close ( INPUT );


open( OUTPUT, "> $ofile" );

        $output = ~ s/AAA*?BBBt/AAA 111 *?222 BBB/g;

        print OUTPUT @match_lines;
close ( OUTPUT );

#rename($ofile, $ifile) ;





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to