| flattens the compound objects into a list. For example, this operator should be used when you pass a list to a subroutine, which expects a list of scalars:
sub sum($a, $b) { Β Β Β $a + $b }Β my @data = (10, 20); say sum(|@data); # 30
Without the | operator, the compiler will report an error, because the subroutine expects two scalars and cannot accept an array as an argument:
Calling sum(Positional) will never work with declared signature ($a, $b)