http://www.perlmonks.org?node_id=894486


in reply to Parse::RecDescent grammar definition

Return value (if you don't specify anything through $return) is the value of the last successfully matched items. The information can be found in the documentation in section 'Subrules':

The value associated with a subrule is the value associated with its $return variable (see "Actions" below), or with the last successfully matched item in the subrule match.

The second problem is that your print statement only belongs to the second rule, i.e. if Pre is matched, nothing is done at all. You might check the return value of your call to $p2->Format to see if a production was parsed successfully