I want to copy a file from /var to /tmp in perl. When I use link(), I got this error: Cross-device link. Though it is understandable, what is the solution then?
I know I can do it using system("cp $oldfile $newfile"), or I can use file read/write to create the file through a loop. But, neither is ideal way to do this.
Could someone here know a better way?
Many thanks.
I know I can do it using system("cp $oldfile $newfile"), or I can use file read/write to create the file through a loop. But, neither is ideal way to do this.
Could someone here know a better way?
Many thanks.