The perfect tense should be used when an action has been completed. For example, if you have done your shopping you would say: "j'ai fait du shopping". The imperfect tense should be used when an action has been continuous in the past. For example, if you lived in London for five years you would say: "j'habitais à Londres depuis cinq ans". It can also be used if an action happened regularly in the past. For example, if you used to go to the cinema every Saturday you would say: "j'allais au cinéma chaque samedi".