in reply to Re: Matching Question
in thread Matching Question
#!/usr/bin/perl -w print "\nWhat file would you like to open: "; chomp($file = <STDIN>); print "\nAttempting to open $file\n"; open(FILE, "< $file") || die "Unable to open file: $!\n"; open(OUT, "> '$file.new'") || die"Unable to create new file: $!\n"; while (<FILE>) { $count++; $text = $_; if ($text eq "go") { $gocount++ if s/^go/\//g; print OUT; } } print "\nThere are $count lines in the file\n"; print "Go count equal $gocount\n"; close(OUT) || die "Unable to close OUT file: $!\n"; close(FILE) || die "Unable to close file: $!\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Matching Question
by mr2 (Friar) on Sep 21, 2002 at 09:38 UTC | |
by curtisb (Monk) on Sep 23, 2002 at 11:24 UTC |