CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Looping over a directory, and using Write Filehandle

 



AdrianBM
New User

Mar 15, 2002, 7:14 PM

Post #1 of 2 (610 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)
Attachments: clean1.txt (3.54 KB)


Paul
Enthusiast

Mar 16, 2002, 1:44 AM

Post #2 of 2 (605 views)
Re: [AdrianBM] Looping over a directory, and using Write Filehandle [In reply to] Can't Post

I don't see any code. Also please add it as an attachment or paste it into your original thread so I can remove this thread.


(This post was edited by RedRum on Mar 16, 2002, 1:44 AM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives