my @indexes = ( 2, 3, 4, 5 ); my $p = \\@MDarray; $p = \($$p->[$_]) for @indexes; $$p = ...;