in reply to Rename All Files In a Directory

You are also trying to rename the directories and anything else listed (and matched) in that directory. (such as '..'). This is probably not what you want to do:

Try this to read in only the files.
@files = grep { -f "$dir/$_" } readdir(DH);
UPDATE: Or in chapter 9.5 of the Cookbook:
use DirHandle; sub plainfiles { my $dir = shift; my $dh = DirHandle->new($dir) or die "can't opendir $dir: $!"; return sort # sort pathnames grep { -f } # choose only "plain" files map { "$dir/$_" } # create full paths grep { !/^\./ } # filter out dot files $dh->read(); # read all entries }

also please do not link to 'illegal' copies of books here...