Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Location
    England, Essex
    Posts
    1,505

    A new line in perl

    if($REMOTE_ADDR) {
    print INFO "$date - $REMOTE_ADDR ran $SCRIPT_NAME at $SERVER_NAME n";

    ok what is stopping a newline being generated in a normal text file?
    Im not very clued up on perl, and I'm presuming thats what the "n" is for. I've tried "\n" (the same for most other languages I work with), but this did not work.

    Each time this piece of code is executed, it just gets written in one continuous line.

    Cheers

    Leigh

  2. #2
    Join Date
    Apr 2005
    Location
    Internet
    Posts
    1

    Re: A new line in perl

    Originally posted by essexguy
    if($REMOTE_ADDR) {
    print INFO "$date - $REMOTE_ADDR ran $SCRIPT_NAME at $SERVER_NAME n";

    ok what is stopping a newline being generated in a normal text file?
    Im not very clued up on perl, and I'm presuming thats what the "n" is for. I've tried "\n" (the same for most other languages I work with), but this did not work.

    Each time this piece of code is executed, it just gets written in one continuous line.

    Cheers

    Leigh
    Newline character is '\n', but only in UNIX-like OSes it is enough. Windows, for example, use two chars: '\n\r' and Macs use '\r'. So, it depend on how and where do you view this file.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •