You are using the Switch module, which can cause weird situations due to its code rewriting nature.
As a first step, have you tried rewriting your code without use of the Switch module?
As a second step, remove parts of your code until the problem disappears. Most likely, the part you removed contains a part of the problem. You have posted far too much code and far too little input data for us to properly attempt to reproduce your problem. See SSCCE for what helps us help you better.
Note that you are using chomp:
chomp($line);
This will not remove any ^M characters from the end of $line.
Most likely, you want to remove all whitespace from the end of the line instead, or all "newline-ish characters":
$line =~ s![\r\n]+$!!; # just newlines $line =~ s!\s+$!!; # all kinds of whitespace
In reply to Re: Hidden Newline in Result
by Corion
in thread Hidden Newline in Result
by phamalda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |