in reply to open file and write the content into another file

If you just want to copy files you could use File::Copy

use File::Copy; copy($src,$dst);