in reply to Line by Line file processing

Open the MASTER file
open(FH,"masterfile.txt") or die("Can't open the file : $!");
Read master file contents and put it array
@masterContents = <FH>;
Read only the CHILD file details from master file content
@childDetail = @masterContents[-3 .. -1 ];
childDetail array will contain the last 3 lines of child details. Then Apply the programming logic.