Reading from a file and assigning to an array in perl

I wrote a simply perl that searched a file for a particualr value and if it found it, rite it and the next three lines to a file. Now I have been asked to check those next three lines for a different value and only write those lines if it finds the second value.

I was thinking the best way to do this is write the lines to an array when I find the first value, then start searching for the second value. If it finds the second value, write the array to a file.

So how do I transfer the lines to an array in perl one at a time?

If you have a better suggestion, I will listen to that also

push @array, $line;