September 2017
Beginner
402 pages
9h 52m
English
The cross operator X creates all possible combinations of the elements of its operands. Compare the work of this operator on the same data that we used in the example for the Z operator.
my @odd = 1, 3, 5, 7, 9;my @even = 2, 4, 6, 8, 10;my @all = @odd X @even;say @all;
This time, the resulting array is much bigger, as shown here:
[(1 2) (1 4) (1 6) (1 8) (1 10) (3 2) (3 4) (3 6) (3 8) (3 10) (5 2) (5 4) (5 6) (5 8) (5 10) (7 2) (7 4) (7 6) (7 8) (7 10) (9 2) (9 4) (9 6) (9 8) (9 10)]
Read now
Unlock full access