($_**2 for 1..10);
($_**2 if !($_ % 2) for 1..10);
($_**2 if $_ % 2 == 1 for 1..10);
my @list = ($_ if $_ %2 == 1 && $_ > 2 for 1..6 );
($_ for "ABC".comb X~ "XYZ".comb);
my @a = (1,3,4);
my @b = (2,4,6);
my @list = (@a X @b);
($_ when /7$/ for 1..99);
my @a = <Hello World IBM Apple>;
(.lc for @a);
my @freshfruit = ' banana', ' loganberry ', 'passion fruit ';
(.trim for @freshfruit);
my @vec = 2,4,6;
(3*$_ for @vec);
(3*$_ if $_ > 3 for @vec);
(3*$_ if $_ < 2 for @vec);
my @vec = 2,4,6;
([$_, $_**2].perl for @vec);
([$_, $_**2].WHAT for @vec);
(($_, $_**2).perl for @vec);
(($_, $_**2).WHAT for @vec);
my @vec1 = 2,4,6;
my @vec2 = 4,3,-9;
($_ for @vec1 X* @vec2);
($_ for @vec1 X+ @vec2);
($_ for @vec1 Z* @vec2);
($_ for @vec1 >>*<< @vec2);
my @a = ([1,2,3], [4,5,6], [7,8,9]);
@a[0];
@a[0][1];
@a[0][2];
($_[1] for @a);
($_[2] for @a);
($_[2]-1 for @a);
(@a[$_][$_] for 0..2);
sub transpose (@m) {
@m[0].keys.map: {[ @m»[$_] ]};
}
my @a = [< a b c d e >],
[< f g h i j >],
[< k l m n o >],
[< p q r s t >];
(.say for @a.&transpose);
my $n = 20;
my @a = gather for 1..$n -> $x {
for $x..$n -> $y {
for $y..$n -> $z {
take $x,$y,$z if $x*$x + $y*$y == $z*$z;
}
}
};
say "@a[]";