#!/usr/bin/perl use strict; open(ARCHIVO, '+){ if(/hola/){ print "$_\n"; $_ =~ s/hola/cha000/g; print "$_"; } } close(ARCHIVO);