When I run my program on a linux machine it opens, renames, and unlinks the files as expected. However, when I run it on Windows it will not rename or unlink the files. Since it is opening and reading the files correctly, it seems that the problem is not in the difference between the path name styles.
Here are the relevant parts of the code:
Expand|Select|Wrap|Line Numbers
- open(INFILE, '<', $the_infile) || die $!;
- #read from infile, modify contents
- open(OUTFILE, '>', $the_outfile) || die $!;
- #print modified contents to outfile
- open(ORIG_INFILE, '>', $original_outfile) || die $!;
- #copy content from INFILE to ORIG_INFILE
- unlink("$the_infile");
- #Rename the OUTFILE with the same name as the INFILE
- rename($the_outfile, $the_infile);
- close (ORIG_INFILE);
- close (INFILE);
- close (OUTFILE);
Any suggestions would be greatly appreciated!
Thanks!