Thye Past Perfect denotes an action completed before a certain moment in the past. The moment may be indicated by another past action expressed by averb in the Past Indefinite or by an adverbial phrase.
They had walked only a few steps when a second group of tanks dre up on the side road.
I had gone to bed and fallen asleep, when my guardian knocked at the door.
Sometimes the Past Perfect dos not dente priority but only the compleyion of the action.
He waited until she had found the latch-key and opened the door.
The Past Perfect is used to denote an action when began before a definite moment in the past, continued up to that moment and was still going on at that moment.
The ride had lasted about ten minutes, when the truck suddenly swerved to a halt.
Past Perfect is not used to denote a succession of actions. In this case the Past Indefinite is used.
He went on with his work after he had a short rest.
He had a short rest beforte he went on with his work.
Verb of motion and sense perception such as to come, to arrive, to return, to see, to hear, in adverbial clauses of time are generally used in the Past Indefinite and not in the Past Perfect. The actions are practically simultaneous.
When he came down…he found hi mother scrupulous in a low evening dress…
When he heard the first line of the poem, he recognized it at once.
When the completion of the action is emphasized the Past Perfect is used.
He knew the poem by heart when he had heard it several times.