Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex :sigspace modifier example causes error #8

Open
7stud opened this issue Jan 7, 2017 · 0 comments
Open

Regex :sigspace modifier example causes error #8

7stud opened this issue Jan 7, 2017 · 0 comments

Comments

@7stud
Copy link

7stud commented Jan 7, 2017

In Introduction to Perl 6 Regex, in the section titled modifiers, the example using the :sigspace modifier causes an error. The text says:

This is so useful that Perl provides a nice short-cut for it.

/\s*One\s+small\s+step\s*/      # yuck
m:sigspace/One small step/      # much better
mm/One small step/              # even better!

However, the last line causes an error when I try it:

~/p6_programs$ perl6 -v
This is Rakudo version 2016.11 built on MoarVM version 2016.11
implementing Perl 6.c.

~/p6_programs$ cat 4.pl
# vim: filetype=perl6

$_ = "One    small  step";
mm/One small step/;             # even better!
say $/;

~/p6_programs$ perl6 4.pl
===SORRY!=== Error while compiling /Users/7stud/p6_programs/4.pl
Missing required term after infix
at /Users/7stud/p6_programs/4.pl:4
------> mm/One small step/⏏;             # even better!
    expecting any of:
        prefix
        term

Using the modifier :s works as described:

~/p6_programs$ cat 4.pl
# vim: filetype=perl6

$_ = "One    small  step";
m:s/One small step/;             # even better!
say $/;

~/p6_programs$ perl6 4.pl
「One    small  step」
@7stud 7stud changed the title Regex modifier example causes error Regex :sigspace modifier example causes error Jan 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant