<br>
<div>An idiom I have found useful, to process all files in the current directory, with a certain extension, is:</div><div><br></div><div>  Â  for (glob("*.something")){</div><div><br></div><div>  Â  Â  Â  open F, '<', $_ or die "open: $!";</div>

<div>  Â  Â  Â  dosomethingwith(join '',<F>);</div><div>  Â  Â  Â  rename $_, "$_.processed" or die "rename: $!"</div><div>  Â  };</div><div><br></div><div>This has served, and continues to serve, very well, in various situations.</div>

<div><br></div><div>I tried that today on a Windows machine and got "rename: permission denied." I further loosened the security on the working directory to no effect.</div><div><br></div><div>Eventually I tried </div>

<div><br></div><div>  Â  Â die `move $_ $_.processed`;</div><div><br></div><div>instead of the rename line and got a different error message, about the file being opened by another process.</div><div><br></div><div>Then I remembered: Perl does not automatically close a file handle when it is done reading it. You can seek() on the handle and to reread the file from the beginning, or maybe the file will grow at the end -- anyway, the handle is open, and Windows won't let you rename a file that has open handles on it.</div>

<div><br></div><div>A "close F" before the rename took care of the problem.</div><div><br></div><div>Is this worth trying to file as a bug with the Strawberry Perl project, that the error messages can be misleading? </div>

<div><br></div><div>In general, your takeaway from this note is to supposed to be a a reminder that Perl (at least Strawberry -- haven't tried my idiom with ActiveState) error messages on Windows are inferior to the error messages from native tools, and may be incorrect.</div>

<div><br></div><div><br></div>