in reply to Strange read file behaviour
Your file most likely has Windows line endings, i.e. \r\n. When you read the file on Linux, the crlf PerlIO layer which translates \r\n to \n is not in effect by default, as it is on Windows (so the \r remains), and chomp only removes what is in $/, i.e. \n.
(\r positions the terminal's cursor to the beginning of the line, so subsequent text overwrites whatever had been written there before...)
Fix:
open DIRECTORIES, "<:crlf", $source or die $!; ^^^^
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Strange read file behaviour
by saintex (Scribe) on Jun 28, 2010 at 12:10 UTC | |
by ikegami (Patriarch) on Jun 28, 2010 at 15:37 UTC |