46 users online (0 members and 46 guests)  

Thread: LOG File...


  Results 1 to 2 of 2

Related

  1. Replies: 1
  2. Replies: 1
  3. Replies: 4
  4. zipping up a file    Forum: HTML Forum
    Replies: 2
  5. ATN File    Forum: Graphics Forum
    Replies: 3
  1. #1
    Priya Agarwal's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2006
    Posts
    3

    LOG File...

    How do I write error into a LOG file?

  2. #2
    Michaels PerlSrv's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2006
    Location
    Europe
    Posts
    2

    Re: LOG File...

    Hello Priya,

    You open the log file, you print to the open logfile, you close it:

    open F, ">myLog.log" or die "can not open logfile $!\n";
    print F "Error xxx occured\n";
    close F;


    F is the file handle, you can use with print. The > says you open it for output (writing to the file).

    You can print whatever is necessary for you, e.g. a constant message, as in my example, the content of a variable, the return value of a system call (to the command line) etc. That's up to you. \n is simply a new line (carriage return).

    Hope this helps. Good luck.

    Kind regards, Michael



Tags for this Thread