Both tenses express an action that was done in the past. However, the imperfect is used to speak about a habit, something that is done often and regularly. The perfect tense is used to speak about a single action in the past that doesn't happen regularly. To form the imperfect, you take the root of the word and add the imperfect endings. For example: take the word "manger" (to eat). The root of the verb is "mange-". The endings go "je mange-ais; tu mange-ais; il mange-ait; nous mange-ions; vous mange-iez; ils mange-aient". To form the past perfect, you need the present tense of the auxiliaries "avoir" (to have) or "être" (to be) depending on the verb. You then take the past participle of the verb. For example: the past participle of "manger" is "mangé". Manger in the past perfect gives: "j'ai mangé; tu as mangé; il a mangé; nous avons mangé; vous avez mangé; ils ont mangé". It is the same process with the auxiliary "être" except one must know if the person speaking is a man or a woman since there must be a grammar agreement with the verb "to be".