How to use opendir in Perl?

Zeebo17

New member
Hi,

I have a list of file names and path names and I want to cycle through each file and modify it. I have tried something like:

for($i=0; $i<10; $i++){
opendir(MYDIR, $path[$i]); #where the paths are in the form "/dir1/dir2/"
$the_infile = $filename_list[$i]; #where the filename_lists are in the form "filename.str"
$the_outfile = 'fixed_'.$filename_list[$i];
#write corrections to output fIle...
closedir(MYDIR);
}

but the modified output file is not showing up in the directory. The program works fine when writing files to the current directory, but I'm not sure how to do it for the sub directories.

Any suggestions would be greatly appreciated!
print STDERR $the_outfile; doesn't give any errors but prints out the expected output file name.
 
Back
Top