This paper addresses the problem of how and when learning is an aid to evolutionary search in hierarchical modular tasks. It brings together two major areas of research in evolutionary computation, the performance of evolutionary algorithms on hierarchical modular tasks, and the role of learning in evolutionary search, known as the Baldwin effect. A new task called the jester's cap is proposed, formed by adding learning to Watson, Hornby and Pollack's Hierarchical-If-and-only-If, function, using the simple guessing framework of Hinton and Nowlan's Baldwin effect simulations. Whereas Hinton and Nowlan used a task with a single fitness peak, ideally suited to learning, the jester's cap is a hierarchical task that has two major fitness peaks and multiple sub-peaks. We conducted a series of simulations to explore the effect of different amounts of learning on the jester's cap. The simulations demonstrate that learning aids evolution only in search spaces in which the simplest level of modules are difficult to find. The learning mechanism explores local regions of the search space, while crossover explores neighborhoods in higher-order modular spaces.