Perl6 的數列,語法非常有彈性,寫法如下:
my @seq = 3, 9 ... * > 30; # 數列 3, 9, 15, 21, 27, 33 say @seq; #=> 結果: # 3 9 15 21 27 33 my @numbers = ^20; # 0 ~ 19 @numbers[5..19] = 3, 9 ... *; 由第六個元素起,填入數列 3, 9, 15, 21, ..., 63 69 75 81 87 say @numbers; #=> 結果: # 0 1 2 3 4 3 9 15 21 27 33 39 45 51 57 63 69 75 81 87