Sorry for one more mail, but just for the record: that has been my own fault. My both problems (KEY1 => 'undef' and having to use ref $item{value}) were caused by these change in P:RD:
- BACKWARDS INCOMPATIBLE CHANGE: The key of an %item entry for a repeated subrule now includes the repetition specifier. For example, in: sentence: subject verb word(s) the various matched items will be stored in $item{'subject'}, $item{'verb'}, and $item{'word(s)'} (i.e. *not* in $item{'word'}, as it would have been in previous versions of the module). I should have used $item{'value(s)'} above, sorry Regards Alex > -----Original Message----- > From: ext [mailto:[EMAIL PROTECTED] > > 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}; HERE I SHOULD HAVE WRITTEN: push @{$::hol{uc $item{keyword}}}, @{$item{'value(s)'}}; Ron, you had misleaded me ;-) But I still appreciate your replies. > > } > > 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. >