I am dealing will many thousand fairy small files.
I need to search them for various matches and depending on what I find, may need to search some files again for additional matches.
Generally speaking, is it better to write a txt file to an @array/@list and then work with it (multiple searches within it, creating $vars etc.) or open the file and go through it few times using while?
ie. Say I am searching through a file for A, B and C.
Depending what I find, I may then need to look in the same file for 1, 2, 3. Also, I will not always find A, B and C in that order.... it could be B, A, C etc.
I could just open the file and use while to look line by line for matches and depending on what I find I could use another (or more) while to go through the file again and close it when done.
OR, I could write the file to @list and search it for what I want.
Depending on what I find, some files will need a lot of searching, some very little.
Is there a rule of thumb for which approach is faster / easier on resources when dealing with thousands of files?
Thanks,
-OG-