Assuming you have not written any code yet, this should get you started: use warnings; and use strict; open the file Write a while loop that reads each record Within the loop, check if the record is of interest, probably using a regular expression and m. "pull out the subsequence" (whatever that means). End the loop. close the input file.