Skip to content

Arrays in Perl 6

James E Keenan edited this page Feb 28, 2016 · 7 revisions

Basic questions about arrays.

You can define arrays of fixed length, then assign to individual elements.

#!/usr/bin/env perl6

my @array[10];
@array[0] = 7;
@array[3] = 'string';
say @array;

Output:

$ perl6 array.pl6 
[7 (Any) (Any) string (Any) (Any) (Any) (Any) (Any) (Any)]
Clone this wiki locally