DevM has asked for the wisdom of the Perl Monks concerning the following question:
The results look like this:# my $input = "(cvtype='problem') and (problem_description match '*' +) and ((problem_synopsis match 'FCSIM') or (problem_synopsis match 'A +TTE')) and (create_time>time('06/01/2014 0:00:00')) and (create_time< +time('09/30/2014 0:00:00'))"; my $input = "(cvtype='problem') and (problem_description match '*') +"; print "Text: $input\n"; my $grammar = q{ startrule: expr expr: operand operation(s?) { $return = @{$item[2]} ? { $item[2], $item[1]} : $item[1]} operation: /and | or/ operand { $return = { $item[1], $item[2] }} operand: '(' expr ')' { $return = $item[2] } | term { $item[1]} term: /[\w\s=><\/:"'\*_]+/ }; my $parser = Parse::RecDescent->new($grammar); my $result = $parser->startrule($input) or die "Could Not Parse! +\n"; print Dumper $result;
$VAR1 = { 'ARRAY(0xa102e8)' => 'cvtype=\'problem\'' }; I expected the results to look something like this: $VAR1 = { { 'cvtype=\'problem\'' } { and } { problem_description match \'*\' } };
I know I am missing something fundamental. But I can’t seem to find it. I don't have any Idea where that array ref is coming from.
Any help you can provide would be helpful.
P.S. I also have the Debug output but it's huge. Please let me know if you think I should post it.
Thank You,
DevM
|
|---|