Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^5: How can I print all lines?

by SuicideJunkie (Vicar)
on Aug 10, 2017 at 15:00 UTC ( #1197177=note: print w/replies, xml ) Need Help??


in reply to Re^4: How can I print all lines?
in thread How can I print all lines?

Step 1: What exactly is it you don't like? (CRLF in the middle of your print)

Step 2: Where in the code does it do that? (Somewhere between printing the text of the line and printing the IN or OUT, conveniently, this is on the same line so you don't have to look very far.)

Step 3: Consider what it is doing there. Add debug prints to make clear what your variables are at that point. (There's a \n before your \tIN... and the $column[$number] is the thing before the \t... print "-=)$column[$number](=-";? Well, that will prove that you've got a CRLF in there.)

Step 4: Understand. The CRLF is in your string because every line of your file ends with a CRLF, of course!

Step 5: Fix it. chomp was made for this.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2021-10-25 05:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (89 votes). Check out past polls.

    Notices?