supergiantrobot has asked for the wisdom of the Perl Monks concerning the following question:
P6R is fun, but a little maddening, too. I see that I am going to have to learn Perl 6 more! Anyway, I am stumped why $0 doesn't contain three hash keys in the code below.
The input looks like this:
Shouldn't $0 have hash keys foo and deck?hEAD: one DeCK: two By: three four I<five six> BiO: seven
use strict; use Perl6::Rules -debug; rule head :i { HEAD <COLON> } rule deck :i { DECK <COLON> } rule byline :i { BY <COLON> } rule bio :i { BIO <COLON> } rule body :w { <para> [<blankline> <para>]* } rule para :w { <line>+ } rule figure :i { } rule line { <word>+? \v } rule word { <italics> | <[\S+]>? } rule italics :w { I <LANGLE> ([<word>|\v]+) <RANGLE> } rule blankline { ^^$$ } rule COLON { \: } "abcd" =~ m/a $?foo:=(..) d/; print "yes" if ($0->{foo} eq "bc"); $0->dump(); # # get all input my @line = <>; my $line = join('', @line); if ($line =~ m:words/ <head> $?foo:=(<line>) <deck> $?deck:=(<line>) [<byline> $?by:=(<line>)]? /) { $0->dump(); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl6::Rules oddity?
by TheDamian (Vicar) on May 03, 2004 at 22:22 UTC | |
by supergiantrobot (Acolyte) on May 04, 2004 at 04:06 UTC | |
by TheDamian (Vicar) on May 04, 2004 at 21:10 UTC | |
Re: Perl6::Rules oddity?
by hossman (Prior) on May 04, 2004 at 06:32 UTC | |
by broquaint (Abbot) on May 04, 2004 at 16:26 UTC |
Back to
Seekers of Perl Wisdom