Dear Monks, I am experiencing the strangest possible issue and have no ideas left anymore. Any help is appreciated. I am essentially reading 3 types of text files from a directory, parsing them using Text::CSV and then writing them to an Excel file using Excel::Writer. All was working well. Then I decided to copy on of the text files (p220-816867-052_avl.txt) to the same directory under a different name (p220-816867-053_avl.txt). The code reads each file in sequence. Now what is happening is that after processing the original files with success, when the code comes to process p220-816867-053_avl.txt, the (while my $line = <FILE>) is reading the whole file in one line and this skipping all newlines in the file. I spent hours trying to figure out but to no avail. I checked and the file p220-816867-053_avl.txt does have 80 lines. It is the same file as the original that I copied from. But the while command is reading the whole file in one line? Any ideas and thanks in advance

In reply to Issue with read a file by dlal66

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.