Mark Wagner wrote: > I'm working on a program to process Wikipedia pages. Wikipedia pages > can contain templates of the form: > > {{template name > |key = value > |key2 = value2 > |... > }} > > Any value may in turn be a template, with essentially no limit to the > level of nesting. Given a "key = value" pair, how would I go about > retrieving the entire template from the page? > > In C, I'd use strstr() to find the "key = value" pair, walk my way > back up the string until I found an unmatched "{{" as the beginning of > the template, and walk down the string until I found an unmatched "}}" > as the end. How would I do this in Perl? > > Are you looking for the way to implement the outlined algorithm in Perl, or suggestions on other ways to process the data? By "processing the data" as far as the question goes, you're looking to create a hash for each template?
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/