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:
hEAD: one DeCK: two By: three four I<five six> BiO: seven
Shouldn't $0 have hash keys foo and deck?
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(); }

In reply to Perl6::Rules oddity? by supergiantrobot

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.