in reply to Re: Removing Newline Characters from File Data (chomp not working)
in thread Removing Newline Characters from File Data (chomp not working)
From the op's code, $firstline appears to be scalar context, not list context (which would use the sigil '@' rather than the op's sigil '$'). In scalar context, the input operator '< >' only returns the next line; in list context (e.g., @firstline), the input operator '< >' will read all the lines in the file...one line per list element in @firstline). Hence, that part of the op's code looks to me to be OK.
I believe that the other responders' notations and observations (i.e., that the op has failed to account for the what is actually at the end of each input line in terms of the line separators) are the likely source of the op's difficulties.
|
|---|