There are several ways -
- you can do it the tedious way by opening 2 filehandles and writing the contents of one to the other.
- you can use a module, File::Copy, ex.
- or easiest, use a system function, ex.
system("cp -pr file_one.txt file_two.txt"
moving it to another directory is just as easy, use an absolute or relative pathname -
system("cp -pr oldfile.txt /big/dom/xtrickortreat/trickster/test1/oldfile.txt"
system("cp -pr oldfile.txt ../test1/newfile.txt"