We present a system to recognize phrases based on perceptrons, and a global online learning algorithm to train them together. The recognition strategy applies learning in two layers: a filtering layer, which reduces the search space by identifying plausible phrase candidates, and a ranking layer, which discriminatively builds the optimal phrase structure. We provide a recognition-based feedback rule which reflects to each local function its committed errors from a global point of view, and allows to train them together online as perceptrons. Experimentation on a syntactic parsing problem, the recognition of clause hierarchies, gives state-of-theart results and evinces the advantages of our global training method over optimizing each function locally, as in the traditional approach.