Let's go with the easier one:
Past Perfect: past in the past. You are talking/writing about the past -past simple- and then you need to refer to something that happened before the past moment you are talking about. Then you need past perfect and then switch to past simple again to go on with your story: I saw Mary yesterday, she was fine and we chatted about this and that and I told her what you had told me about Tom and Mary. She was surprised to find out...(In this example, you are talking about the past -yesterday (saw, was, chatted, told)- and the story progresses, more or less, in chronological order but then you need to refer to something that happened before 'yesterday' -let's say last week that person told her something about Tom and Mary -past perfect (had told)- and then turn back to past simple because you talk about 'yesterday' again ('she was surprised...).
There are other uses for the past perfect -conditionals, indirect speech... but I don't think I should include them here-.
The Present Perfect is a bit more complicated. First of all, keep in mind it is PRESENT, so don't combine it with past time expressions (last year, yesterday, in 1998, when I was five, etc) There are three basic usages:
-To talk about EXPERIENCE: Personal experiences at some time in someone's life but DON'T SAY WHEN, it is not important now: I have been to China. (if asked about details, then answer with the past simple: in 2004, I visited Beijing, I stayed in a hotel....)
-To give NEW INFORMATION/NEWS: Information you think the other person doesn't know, even if it happened in the past, but you think it is new for that person.
A: Hi Tom. I last saw you three months ago. How's things?
B: Oh, I've found a job and I have moved to London. (quite an artificial dialogue but it serves the purpose). Here again remember it is present so don't use finished-time expressions or, if you do use the past simple (Oh, I found a job last month and moved to London two weeks ago).
Normally you give new information about very recent events and books say it is to express the present result of a past event. 'I have broken the cup', 'I have lost my keys'. The meaning is quite similar if you come to think of it.
-From the PAST into the PRESENT: To talk about actions, states, events...that started in the past and are still going on, over a period of time: 'I have lived in this city since I was born (It started on the day I was born and I still live in this city' Note the contrast with the present simple 'I live here' (my routine), but can't be used for a situation expanding over a period of time (from the past into the present).
And that's all you need to know. I hope you'll find it useful and I think it's the longest post I have ever written. Bye