Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: scope issues in Parse::RecDescent

by jethro (Monsignor)
on Mar 22, 2011 at 13:36 UTC ( [id://894797]=note: print w/replies, xml ) Need Help??


in reply to scope issues in Parse::RecDescent

my $p6 = Parse::RecDescent->new(q( letter : /\w/ character : letter Format : character(s) )); my $x= $p6->Format('abc'); die "Invalid pattern" unless (defined $p6); print Dumper $x; #prints $VAR1 = [ 'a', 'b', 'c' ];

Be careful to specify what a rule returns with $return if more than one production is in a rule (i.e. with a rule like "strangeword: character number character(s)", since only the last production is returned as a default

With $return you can also return anything you want, i.e. parsed and interpreted commands, hashes, objects ...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://894797]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-05-28 18:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found