I have previously managed to do this with one file
That's a good place to start. Might I suggest the following approach to help extend this to several files?
- Take your working code and move it into a subroutine (see perlsub) which takes the filename to be read as the only argument. Confirm the script still works as before.
- Now simply call the subroutine twice in the script with a different filename each time. Confirm that the script produces the output you expect for two input files.
- Now write your loop to find all the files in the directory and just call the subroutine from within the loop. You should now have output from all the files.
Portioning up the code into smaller blocks (such as using subroutines) helps you to work on small parts of a larger problem in isolation. If you have specific problems with any particular part feel free to ask. Remember that an SSCCE is best. Good luck.