Perl 6
Amazing Perl 6: Revision 10

This page lists some amazing Perl 6 snippets. The list after the title refers to the keywords for the snippet.


  • custom operators
  • reduce operator
  • range operator
  • placeholder variable
sub postfix:<!> { [*] 1..$^n }
say 5!;


Custom Operators

There is a set of special sub declarations that interfere in the parsing of the language, these are the:

  • prefix
  • postfix
  • circumfix
  • infix
  • postcircumfix

you declare them by using type:identifier, where the identifier is quoted using the '<' and '>', optionally « » when you want to use '<' or '>' as part of the identifier. Some examples of subs that come defined in Perl 6 core are:

  • prefix:<^> which is the operator that turns ^100 into 0..99
  • postfix:<i> which allows you to use complex numbers as in 1 + 2i
  • circumfix:<( )> which creates a unflattened capture as in (1,2,(3,4,(5,6)))
  • infix:<+> which sums two values, as in 1 + 2
  • postcircumfix:<{ }> which is used as the hash subscript as in %a{$b}

So when you declare a sub postfix:<!> you are declaring a language operator that lives in the same level as any other Perl 6 operator.


  • gather/take
  • lazy lists
  • bind
my @a := gather for 1..1000 -> $i { say $i; take $i };
say @a[10]; # prints 1 2 3 4 5 6 7 8 9 10

Buy Wellbutrin Wellbutrin Usage Stop Smoking Pill

Upload Files

Click "Browse" to find the file you want to upload. When you click "Upload file" your file will be uploaded and added to the list of attachments for this page.

Maximum file size: 50MB

File Name Author Date Uploaded Size

Save Page As

Enter a meaningful and distinctive title for your page.

Page Title:

Tip: You'll be able to find this page later by using the title you choose.

Page Already Exists

There is already a page named XXX. Would you like to:

Save with a different name:

Save the page with the name "XXX"

Append your text to the bottom of the existing page named: "XXX"

Upload Files

Click "Browse" to find the file you want to upload. When you click "Add file" this file will be added to the list of attachments for this page, and uploaded when you save the page.

Add Tags

Enter a tag and click "Add tag". The tag will be saved when you save the page.