πŸ“˜ Shortcut operator && in Perl 6

&& returns the first of the operands, which, after being converted to a Boolean value, becomes False. If none are False, then the last element is returned. Please note that the result is not a Boolean value but the value of one of the operands (unless they are Boolean already).

say 10 && 0; # 0
say 0 && 10; # 0Β 
say 12 && 3.14 && "" && "abc"; # empty string

The operator stops its work as soon as the acceptable value has been found. The values of the rest of the operands will not be calculated. That is why the operator belongs to the group of shortcut operators.

πŸ“˜ Shortcut operator ^^ in Perl 6

^^ returns an operand that is True in a Boolean context and that is, at the same time, the only one in the given list. If nothing is found, Nil is returned. As soon as the operator sees the second True value, it stops evaluating the rest, because the result is already known.

say 0 ^^ '' ^^ "abc" ^^ -0.0;Β  # abc
say 0 ^^ '' ^^ "abc" ^^ -10.0; # Nil

πŸ“˜ List creation operator , in Perl 6

, creates a List object. Note that this operator, as a few mentioned above, can be chained to accept more than two operands.

my $what = (1, 2, 3);
say $what.WHAT; # (List)

The comma is also used as a separator of parameters passed to the subroutine.

To create an empty list, use a pair of parentheses ().