I've been unable to reference an array element within math mode within PGML. Here is a minimal example, with various things I have tried, none o which work:

for my $i (0..2)

{$a[$i] = random(2,8,1);}

BEGIN_PGML

[`[$a[0]]`]

[:[$a[0]]:]

[`[$a[[0]]]`]

[:[$a[[0]]]:]

END_PGML

{$a[$i] = random(2,8,1);}

BEGIN_PGML

[`[$a[0]]`]

[:[$a[0]]:]

[`[$a[[0]]]`]

[:[$a[[0]]]:]

END_PGML

Is it possible to reference perl array elements using PGML?