in reply to Parse RecDescent Nesting (Followup)

Just found this.
From the Parse::RecDescent FAQ:

CAPTURING MATCHES
Hey! I'm getting back ARRAY(0x355300) instead of what I set $return to!

Here's a prime example of when this mistake is made:
QuotedText: DoubleQuote TextChar(s?) DoubleQuote { my $chars = scalar(@item) - 1; $return = join ('', @item[2..$chars]) }
This rule is incorrectly written. The author thinks that @item will have one TextChar from position 2 until all TextChars are matched. However, the true structure of @item is:

position one: the string matched by rule DoubleQuote
position two: array reference representing parse tree for TextChar(s?)
position three: the string matched by rule DoubleQuote

Note that position two is an array reference. So the rule must be rewritten in this way.
QuotedText: DoubleQuote TextChar(s?) DoubleQuote { $return = join ( '', @{$item[2]} ) }
************************
Further recommended reading.

When to use Text::Balanced or Regexp::Common::balanced rather than P::RD: Parse::RecDescent