in reply to [SOLVED]: Problem when using chomp on line read from file.

The input file uses MSWin line end, i.e. there's a \r before each \n. Either open the file with :crlf, or remove the \r's manually.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Problem when using chomp on line read from file.
by Perl300 (Friar) on Feb 26, 2018 at 22:19 UTC

    Thank you so much for your response. I got it fixed now by adding following line before the while loop

    local $/ = "\r\n";

    Now I get the desired output as:

    Before while @local: Before chomp $line: 12.2(17d)SXB11 After chomp $line: 12.2(17d)SXB11 After push @local: 12.2(17d)SXB11 Before chomp $line: 5.10 Generic_118855-15 After chomp $line: 5.10 Generic_118855-15 After push @local: 12.2(17d)SXB11 5.10 Generic_118855-15 Before chomp $line: XYZ 7.1 After chomp $line: XYZ 7.1 After push @local: 12.2(17d)SXB11 5.10 Generic_118855-15 XYZ 7.1 After while @local: 12.2(17d)SXB11 5.10 Generic_118855-15 XYZ 7.1