in reply to
Storing regex values in an array and processing the array
Not entirely sure of what you want to do, but your program certainly does not do what you want.
Basically, your program reads an input file but does not use it, except as a line count in a sense: for each line in the input file, your program prints the regular expressions that you have stored in the @patterns array. But, as already pointed out, this array contains only one pattern, so that in the end, you are basically only printing the pattern count times, count being the number of lines in the input file.
EDIT: fixed typo.