In reply to sh88:
Although not currently in the 1800-2017 standard, all tools support this proposed syntax:
module top;
bit [31:0]array[int][$] ='{1:{1,2,3,4},2:{5,6,7,8}};
initial begin
foreach(array[2][i]) $display(array[2][i]);
end
endmodule