use Perl6::Rules; grammar Foo { rule number { (\d+) { print "Found '$1'\n"; } } } "123" =~ m//;