First things first. Generate a separate file for each amino acid sequence. Put these flat files into a separate folder. Label each file by the FASTA code. You may then be in a position to put each line of each sequence into the elements of an array. I'm assuming that the sequences correspond to particular proteins.
Looking at your code. I have never seen the following before:
if(!open(MY_HANDLE, "file.txt")){
Try to keep to what you might find in a text book.
Your taking a single argument as an id and then worked with an array
@id. That needs to be fixed.
I am assuming that you know that your regular expression does not match what you have said in the text.The standard input is the protein code ID but the regular expression that is search for is a protein motif. You are jumping ahead of yourself in the code. I expect that you will modify the program to then allow for alternative protein motifs to be inputed by the user.