#!/usr/bin/perl -w print "\nWhat file would you like to open: "; chomp($file = ); 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 () { $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";