# print each line after replacing "go" with "/" while () { $count++ if s/^go/\//; print; } print STDERR "There were $count lines starting with 'go' in this file\n";