The perfect tense is used to show or indicate an action that is already completed or perfected.
The perfect tense indicates an action that started sometime in the and completed in the present.
She has done her assignment.
Note: She started doing her assignment sometime in the past (time not specific). At the time of speaking, she is already finished doing her assignment.
I have eaten my lunch.
Note: I started eating my lunch sometime in the past. At present, I am already done or through eating.
*Note” Present perfect is different from the simple past in that the simple past just indicates an action that happened in the past without reference to the present.
The past perfect tense indicates an action that started sometime in the past and completed before another past action.
They had gone to bed when the thief broke into their house.
Note: There are two actions here, both happened in the past –they “going to bed” and thief “breaking in”.
They “going to bed” happened before thief “breaking in”.
So” they had gone to bed” takes the past perfect tense, and “thief broke in ” takes the simple past tense.