in reply to Parse::RecDescent and <score: ...> directive

You have a number of errors in your grammar:

  1. In the rule ip_nosemi, you forgot to backslash the last "</code>\d</code>".
  2. In hosts_or_range, you have host(s?), when you probably meant to put the (s?) in network object.
  3. You can't use $item as both a hash and an array in the same production!

I also reorganized your grammar a bit. It should work now, although I'm on a machine without PRD installed at the moment so you shouldn't just take my word on that. However, tachyon is right on this one; PRD is far too large of a hammer to use parse data like this. :)

startrule: network_object(s) network_object: /network:(\w+)/ '=' '{' 'ip' '=' ip 'mask' '=' ip hosts_or_range(s?) '}' { print "Found network object named $item[1] ", "with IP $item[6] and MASK $item[9]\n" } hosts_or_range: host | host_range host_range: /host:\w+/ '=' '{' 'range' '=' ip '-' ip '}' host: /host:\w+/ '=' '{' 'ip' '=' ip(s) '}' ip: / \d{1,3} (?:\.\d{1,3}){3} ;? /x