Hello, I'm looking for assistance / help on the following. I have a script reading from a file handler, which outputs logs for a program. It then parses these to get the exact folder location. I then have another file handler opened which stores it's contents into an array. It then greps the folder variable from the first while loop, and compares to the array of items from from the 2nd file handler. This is done so there is no duplicate of the folders. It then has an if / elsif statement that compares this for me, and finally writes to the file handler. I've written a few scripts with this / fifo pipes and worked fine, but never had to do it like this with multiple files.

1. The script works, it will not write the folder if already there, and DOES write it if not found in the array. My problem is that the 2nd bit of code seemingly does not keep running. I'm not sure if this is because it's all one block of code, or you can't have two file handlers being continously read from in the same block of code. I know the first part keeps working, because it writes the complete logs to another file, and that file keeps changing with the uploads. Any guidance would be much appreciated. I know some of the code is choppy, using a a few bash strings "not recommended" but that is fine for now. Code below, thank you!!!

#!/usr/bin/perl -w

use strict; use File::Basename qw(basename); use Sys::Syslog qw(:DEFAULT setlogsock);

I do not fully understand what you are doing, but if your inner loop reached the end of your file the first time you executed your outerloop, then, if you need to read the same file again, you have to "rewind" it back to the beginning, either by closing this file and reopening it, or using a function such as seek to position the filehandler at the beginning of the file.

Now, if you plan to read this whole file for every line of the other input file, you might have to consider some other better ways of doing it, such as storing the aforesaid file into memory one way or another (assuming it is not too large to fit in memory). It could be stored as an array of lines, or possibly a hash enabling you to access directly to the data of interest for your processing.