CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Newline command



Feb 22, 2001, 8:44 PM

Post #1 of 3 (368 views)
Newline command Can't Post

I am trying to get a newline (carriage return into my file).

However, when I do:

print $DB "$_\n";

I get a block on the end (as seen in Win Wordpad).

I would like the line that the cursor is on in the data file to be on the next blank line.

What do I need to do in order to get the proper carriage return?

Sean Shrum


Feb 22, 2001, 9:55 PM

Post #2 of 3 (366 views)
Re: Newline command [In reply to] Can't Post

I was just reading about this in O'Reilly's CGI Programming 2nd ed. \n is line feed and \r is carriage return. Windows uses both to indicate a new line, so what you need is \r\n.

>> If you can't control it, improve it, correlate it or disseminate it with PERL, it doesn't exist!


Feb 23, 2001, 2:25 PM

Post #3 of 3 (356 views)
Re: Newline command [In reply to] Can't Post

From what I've heard \n will make a newline for Unix, and \r will make a newline for Windows. But if you read it in a bood, it's gotta be better than my ideas. :)

Jeffrey "muinatit" Lamoureux


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives