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


in reply to Parse::RecDescent - specifying dynamic subrule repetition

Like the other people answering, I'm also wondering "how about reaching for unpack, or substr?" Is this part of a larger grammar?

Perhaps you want to parse string-within-a-string into a nested data structure, which would justify a parser. If that's the case, the String rule should have a recursive alternate. If you just want the outer string, copying literally any inner string without interpretation, then you need a dynamic rule that uses $item{Count} to eat exactly that many characters.

  • Comment on Re: Parse::RecDescent - specifying dynamic subrule repetition