Twenty-one patients with unilateral prefrontal cortical neurosurgical lesions (11 left and 10 right) and 38 patients with unilateral temporal lobectomy (19 left and 19 right) were compared to 44 matched control subjects on their performance on the 3-D Computerized Tower of Hanoi (3-D CTOH) test. The problems were split into those with or without a significant goal-subgoal conflict determined by whether the correct first move in each problem took the subject apparently away or towards the final goal state. The left frontal lesion and right temporal lobectomy groups were significantly impaired on problems with goal-subgoal conflicts. In the left frontal group, this deficit was confined to earlier four-move problems, whereas the right temporal group showed a more general deficit on later five-move problems. The left frontal lesion deficit is explained in terms of an inability to inhibit the response compatible with achieving a final goal, whereas the impairment in the right lesion group was related to a specific impairment in spatial memory.