Just FYI, I've registered a perl bug for that issue
http://rt.perl.org/rt3/Ticket/Display.html?id=29576


> -----Original Message-----
> From: ext [mailto:[EMAIL PROTECTED]
> 
> use strict;
> use vars qw($parser $text %hol);
> use Data::Dumper;
> use Parse::RecDescent;
> $Parse::RecDescent::skip = '[ \t]*';
> $RD_HINT = 1;
> $RD_TRACE = 1;
> $parser = Parse::RecDescent->new(q(
> 
> mmpfile: line(s) /^\Z/
> line: assignment | <error>
> assignment: keyword value(s) /\n/ {
>         # add 1 or more values to the hash of lists
>         push @{$::hol{uc $item{keyword}}}, 
>             ref $item{value} ? @{$item{value}} : $item{value};
> }
> keyword: /key\d+/
> value: /val\d+/
> 
> )) or die 'Bad grammar';
> 
> $text = "key1 val1\nkey2 val2 val3\n";
> 
> defined $parser->mmpfile($text) or die 'bad text';
> print Data::Dumper->Dump([\%hol], ['hash of lists']);
> 

.......
 
> $hash of lists = {
>                    'KEY2' => [
>                                undef
>                              ],
>                    'KEY1' => [
>                                undef
>                              ]
>                  };
> 
> Why do I have undefs above? I've tried changing the terminal to:
> 
>       value: /val\d+/ { $item[1] }
> 
> since the "value" is what's being push()ed. But it didn't help.

Reply via email to