for my $i (0 .. 3) { $array[$i] = { val => rand(time)%3, one => \$array[1]{val} }; }