I\'d like to take a directory and for all email (*.msg) files, remove the \'RE \' at the beginning. I have the following code but the rename fails.
opendir(D
You seem to be assuming glob-like behavior rather than than readdir-like behavior.
The underlying readdir
system call returns just the filenames within the directory, and will include two entries .
and ..
. This carries through to the readdir
function in Perl, just to give a bit more detail on mu's answer.
Alternately, there's not much point to using readdir
if you're collecting all the results in an array anyways.
@files = glob('emails/*');