The imperfect is used for:
- description in the past (eg the door was red - la porte était rouge)
- things that you used to do many times in the past (eg I used to go swimming - je nageais)
- interrupted actions (eg I was eating when the phone rang - je mangeais quand le téléphone a sonné
The perfect tense is used for everything else! Single, punctual actions.