Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Hidden Newline in Result

by Corion (Patriarch)
on Mar 05, 2017 at 19:05 UTC ( [id://1183707]=note: print w/replies, xml ) Need Help??


in reply to Hidden Newline in Result

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

Replies are listed 'Best First'.
Re^2: Hidden Newline in Result
by phamalda (Novice) on Mar 05, 2017 at 19:12 UTC

    Thank you so much for the quick feedback. I really appreciate it. I actually think I've solved it. I removed that tilde from the end of big If/Then/Else statement.

    else { print OUT join ('~', @field) . "\n"; # print OUT join '~', @field; $incount = $incount + 1; }

    It appears that this has produced the desired result. I'll know more tomorrow when we can consume the resulting file. Thanks again for everything.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1183707]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-20 02:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found