use Data::Dumper qw( Dumper ); use Parse::RecDescent (); { local $::RD_AUTOACTION = q { [@item] }; Parse::RecDescent->Precompile( 'parse: /a/ /b/ /c/', 'Grammar' ) or die("Bad grammar\n"); } { # Normally, this would be in another file. require Grammar; my $parser = Grammar->new(); print(Dumper($parser->parse('a b c'))); }