Perl misses lines while reading a file : I'm doing a large (8000 lines) library data conversion. I read in a file and want to modify it line by line. Reading the file stops before reaching the end of the file. 


        open(my $infh, "<", 'infile.pica') 
            || die('Could not open pica file');	
    open(my $outfh, ">", 'infile.pica.norm') 
            || die('Could not open pica file');
            
    my $counter = 0;
    
    while (my $line = <$infh>) {
    	
    	$counter++;
        # for debugging - this is the last line being read. 
        # infile actually has 7857 lines

    	if ($counter >= 7691) {
    		say $line;
    	}
        # modification commented out for debugging
        print $outfh $line;
    }	
    close $infh;
    close $outfh;


My first thought was that there is a strange character in this line but there is nothing

    006X $cEBC$03564211 (original)
    006X $cEBC$035642 (being read, thats what the say prints)


