Operators

Feed operators ==> and <==

Full

Pipe data through a chain of list operations, left-to-right or right-to-left.

The feed operators pass a list through a series of stages, like a shell pipeline. ==> flows left-to-right (data first, then each stage); <== flows right-to-left. They make a map/grep/sort chain read in processing order.

Forward feed — ==> #

Each ==> feeds its left side as the final argument of the next stage; a terminal ==> my @var collects the result.

(1..10) ==> grep(* %% 2) ==> my @evens;
say @evens;
Output
[2 4 6 8 10]

Chain as many stages as you like:

<c a b> ==> map(*.uc) ==> sort() ==> my @s;
say @s;
Output
[A B C]

Backward feed — <== #

<== reads right-to-left — the source is on the right, and data flows up the chain into the variable on the left.

my @r <== map(* * 10) <== (1, 2, 3);
say @r;
Output
[10 20 30]

Notes #