|Pathologically Eclectic Rubbish Lister|
Reading through a file and checking for a specific stringby vihar (Acolyte)
|on Aug 19, 2013 at 19:42 UTC||Need Help??|
vihar has asked for the
wisdom of the Perl Monks concerning the following question:
I am pretty new to coding and Perl. I am not sure what I am doing wrong in this code.
My goal for this script is to read through text files line by line and check if a match is found at a certain place in line. If a match is found, update count and then print it out later.
The first part is where I am storing all files names in an array that I am supposed to be reading.
I have array1 - @types that has these 2 letter strings(which I am supposed to check for in each file in each line, This variable is found in each line at 41st character.) and array2 - @counts where I am trying to store count if that match is found.
Then I am initializing all elements in array2 to 0 since they are all going to be integers. Then I have code to go though each file, each line and check for a match.
This is what my output should look like(with counts next to each)
I am pretty sure there is something wrong with the logic and I can't figure it out. Please help. Thanks in advance!