Parsing file in perl script

Hi Guys,

I have a large text file that is has a bunch of records. Each record starts with a header line that starts with the ">" character. Then there are several lines under that line that contain sequences of letters.

For example, a file might look like:

>TEXT ID=2L TEXT
ABCDEDKGFKGJDJED
ALDKDKKFJFJGF

>TEXT  ID=3R TEXT
FGDFGKDFSKDSLD
FGFDGDSFFDG
FDGF

I can send you the actual file if you would like to see it. All I want is a PERL script that inputs a file in the following format:

ID:START-STOP  SEQUENCE

Where ID is an identifier for the record (in the above record 1 has identifier of 2L and record 2 has identifier of 3R and start and stop are first and last positions of a subsequence in the record. Then there is a space and a SEQUENCE. I can send you an actual file for testing.

I want the script to use the ranges to pull out the subsequence from the big record text file and then see if it matches the SEQUENCE in the input. The big record file is large so you can't load the whole file into memory, you need to stream it.

The output would be the subsequence from the record and a space and a YES or NO for where it matches.

Thanks in advance

if you don't mind, please post the sample output for the above 2 records.
also are you free to use any other tool or only PERL?

also please post the code you have tried so far and where you are stuck with