1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Rep Power

    syntax to overwrite,delete,create, copy a text file ?

    syntax to overwrite,delete,create, copy a text file ?


    i have a text file which i use to keep some data which i will display when i run a perl script.

    what is the perl command to overwrite a text file so that i can show the new information ?

    this text file i use is called info.txt

    how do i delete create.txt and create it again ?

    what is the syntax to copy this text file to be info2.txt, info3.txt ?

    perl / cgi newbie
  2. #2
  3. 11
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jul 2001
    Lynn, MA
    Rep Power
    read the perl documentaion about open
    paying particular attention to "mode".

    Here's a great tutorial on how to use the excellent documentation included with every perl distribution.

    DON'T FORGET TO LOCK YOUR FILES EVERY TIME YOU TOUCH THEM! In a multi-user environment like the web, you HAVE to lock your files on reads/writes, otherwise you're risking losing data. Maybe not today or tomorrow, but it WILL happen.

    Here's a great tutorial on why and how to lock files.

    Check out File::Copy for a cross-platform method of copying files- this is a much better option than shelling out with backticks or whatever.

IMN logo majestic logo threadwatch logo seochat tools logo