The difference is in the action you are talking about and the form of the auxiliary verb "to have".
In the PRESENT PERFECT you are talking about something that started in the past but, somehow, it's still affecting the present.
To form it, you need to use:
subject + to have (present form) + past participle form of the verb
I have lived in Rome for 10 years by now (so I started living in Rome 10 years ago, and I am still living in Rome by the present time).
In the PAST PERFECT, instead, you are talking about something that happened in the past and it finished in the past. The sentence form is the same but now you have to use the past form of the verb "to have":
subject + HAD + past participle form of the verb
I had lived in Rome for 10 years before moving to London (I lived in Rome for 10 years and then I moved to London, so I am not living in Rome anymore).
I hope this helps!
Leggere di piú