in reply to Writing into files and RegExp
You leave the line endings at the end of your file. Most likely, there is whitespace at the end of each line that you want to remove. Such things can happen for example when you create a file with Windows-style line-endings ("\r\n") and then process that file with a perl which only expects Unix-style line-endings ("\n"). As a quick measure of testing that, you could check for whitespace at the end of the lines:
while (<$IN>) { chomp; warn "Whitespace at end of line $.: >$_<" if /\s+$/; ... };
If that indeed is the case, you can either set the input record separator ($/) to the whitespace sequence, or simply strip off all whitespace.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Writing into files and RegExp
by PerlingTheUK (Hermit) on Mar 10, 2006 at 10:32 UTC | |
by Corion (Patriarch) on Mar 10, 2006 at 10:42 UTC | |
by PerlingTheUK (Hermit) on Mar 10, 2006 at 10:52 UTC |