Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
doc infix form for subs
  • Loading branch information
gfldex committed Jun 29, 2016
1 parent 12b7637 commit d7fe27a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/Language/functions.pod
Expand Up @@ -337,6 +337,14 @@ which applies a function to each input element:
my @squared = map &square, 1..5;
say join ', ', @squared; # 1, 4, 9, 16, 25
=head2 Infix Form
To call a subroutine with 2 arguments like a infix operator, use a subroutine
reference surrounded by C<[> and C<]>.
sub plus { $^a + $^b };
say 21 [&plus] 21;
OUTPUT«42␤»
=head2 Closures
Expand Down

0 comments on commit d7fe27a

Please sign in to comment.