http://www.perlmonks.org?node_id=1008956

virudinesh has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on how to read file and create duplicate file for orginal file

Replies are listed 'Best First'.
Re: how to read file and create duplicate file for orginal file
by CountZero (Bishop) on Dec 15, 2012 at 09:40 UTC
    Replies will be given here on this site and not to your private mail.

    File::Copy will do what you want.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics
Re: how to read file and create duplicate file for orginal file
by dbuckhal (Chaplain) on Dec 16, 2012 at 04:45 UTC

    Some psuedocode that helped me write a little program to do it:


    1. choose files for copying (read a directory, for example)
    2. loop though those existing files
    3. open one of those files for reading
    4. open a target file for writing
    5. while files exist for reading
    6.....print to target
    7. close directory

    or....

    use built-in "cp" command from your OS.

    Hope this helps!