in reply to open dir

First off, you could have done a search for opendir and you would have found exactly what you needed. I didn't look through your code, but if all you want to do is read in the file contents of a directory, you could do something like this:
# create a filehandle to the directory - check for errors opendir (DIR, "path/to/directory") or die "Unable to open directory: $ +!"; # read in all file names except . and .. @files = grep {$_ ne "." && $_ ne ".."} readdir (DIR); # close the filehandle to the directory closedir (DIR); # do whatever you want with filenames in @files