This is not really a problem, more of a gotcha. P::RD grammars have interesting behavior with "my" variables - modifications of those variables in actions don't hold outside the grammar. I deal with this problem by using "our" variables (see the example below, try changing $global_var to a "my" variable). Accessor methods are also a possibility, but it's a pain to maintain a lot of those. How do others deal with this?
Thanks Ted ---------------------------------------------------------------- #!/usr/bin/perl -w use Parse::RecDescent; use strict; our $global_var = 0; my $parser = new Parse::RecDescent (q{ external_check: /external/i /user/i /check/i /=/ /\S+/ { $::global_var = 1; print "Assigned the value\n"; 1; } }); $parser->external_check("external user check = test"); print "The global value was assigned\n" if $global_var;