my @a=1,2,3;
my @b=4,5,6;
my @c=7,8,9;
for zip(@a; @b; @c) -> $a, $b, $c {say $a,$b,$c;}
say 0..9 X~ 'a' .. 'z';
for <a b c> Z <A B C> Z 1, 2, 3 -> $x, $y, $z {
say $x, $y, $z;
}
for <a b c> Z~ <A B C> Z~ 1, 2, 3 -> $line {
say $line;
}
.say for [Z~] [<a b c>], [<A B C>], [1,2,3]
my @lines = slurp('3col.txt');
for @lines -> $line {
my @b = $line.comb(/\d+/);
say "@b[]";
say "-" x 45;
}
my $fh = open('3col.txt');
my @l = $fh.lines».comb(/\d+/);
say @l.elems;
sub infix:<中>(@array, $ins) {
@array.splice(+@array / 2, 0, $ins);
return @array;
}
my @a = 1,2,4,5;
say @a 中 3;
class PowerBy2 {
has $.number;
method power_by2() {
return $.number ** 2;
}
}
my $test = PowerBy2.new(number=>10);
say $test.power_by2;
my @a = <1 2 3 4>;
my @b = @a».power_by2;
say @b;
my @scores = 'Ana' => 8, 'Dave' => 6, 'Charlie' => 4, 'Beth' => 4;
my $screen-width = 30;
my $label-area-width = 1 + [max] @scores».key».chars;
my $max-score = [max] @scores».value;
my $unit = ($screen-width - $label-area-width) / $max-score;
my $format = '%- ' ~ $label-area-width ~ "s%s\n";
for @scores {
printf $format, .key, 'X' x ($unit * .value);
}
my @a=1,2,3;
my @b=4,5,6;
my @c=7,8,9;
for zip(@a; @b; @c) -> $a, $b, $c {say $a,$b,$c;}
say [-] <10 5 3>;
say [-] 10;
my @suits = <♣ ♢ ♡ ♠>;
my @ranks = 2..10, <J Q K A>;
my @deck = @ranks X~ @suits;
my %points = @deck Z @( (2..10, 10, 10, 10, 11) Xxx 4 );
@deck .= pick(*);
my @hand = @deck.splice(0, 5);
say ~@hand;
say [+] %points{@hand};