I am not sure if this is doable. I am trying to open and print the content of the file by replacing all instances fo perl to PERL . This is my code but it is
giving me the number count instead of the actual lines with changes.
open (PERLHISTORY, 'sample.txt') or die "The file sample.txt could not be found\n";
@B = <PERLHISTORY>; #Reads the whole line
while ($Line = shift(@B))
{
$NewLine = ($Line =~ s/perl/PERL/gi);
print $NewLine; # This gives a count not the actual changed line
}