
AdrianBM
New User
Mar 15, 2002, 7:14 PM
Post #1 of 2
(369 views)
|
|
Looping over a directory, and using Write Filehandle
|
Can't Post
|
|
I have trouble writing over to a single Filehandle, based on many different files that I am reading in one directory....and Here is what I am doing: 1) Using "foreach", & "readdir" , I am picking up each file in a dir. (total of 12 files), and placing them into $var. 2) Next I read the content of a totally separate file , using open(INPUT, "one_single_input_file") 3) Then I get ready to place the result of the comparison between content of the INPUT file (step 2), and each individual file in step 1 , using Open (OUTPUT, ">${var}_OUT). PROBLEM: At step 3 above only the 1st file (out of the 12) is picked up, and I get an output file with the proper content. However, all other output files will end up having "0" contents, knowing that the file comparison is happening (based on the processes that are going on). I also used "seek()" function to position the file pointer with all possible options, and none made a difference. What am I not doing? It seems to me, one Write Filehandle could not be used for many different filenames (even though, it is placed inside a foreach loop). If that is the case, what are my alternatives? Thanks, Take a look at the attachement for the actual code. I hope this will furtherclarify my problem Attachment is now included!! Adrian
(This post was edited by AdrianBM on Mar 22, 2002, 8:09 AM)
|