I have a perl code where I access multiple txt files and produce output for them. While I run the code, the output lines on the console are overwritten.
2015-04-21:12-04-54|getFilesInInputDir| ********** name : PEPORT ********** PEPORT4-21:12-04-54|readNFormOutputFile| name : PEPORT" is : -04-54|readNFormOutputFile| Frequency for name "
Please note, that the second and third line it should have been like
2015-04-21:12-04-54|readNFormOutputFile| name : PEPORT 2015-04-21:12-04-54|readNFormOutputFile| Frequency for name "PEPORT"
Also, after this the code stops processing my files. The code seems fine. May I know what may be the possible cause for this.
Seems like CR/LF versus LF issue. Convert your input from MSWin to Linux by running
fromdos, or remove the
"\r" characters from within the Perl code.
As choroba says, I guess you are reading a file on Linux that has been generated on Windows. The easiest fix is to replace
Or, if trailing spaces are significant, you can use
s/[\r\n]+\z// or, if you are running version 10 or later of Perl 5,