$hd::size1 = scalar @{\@{$main::M[0]}}; $hd::size = $hd::size1 - 1; for ($hd::i=$hd::save; $hd::i<= $hd::size; $hd::i++) #this creates and adds to the hd array { $hd::store= []; for ($hd::j=0; $hd::j < $hd::i; $hd::j++) { $hd::temp = &hd($main::M[0][$hd::i], $main::M[0][$hd::j]); print $hd::temp; print "\n"; push $hd::store, $hd::temp; } push @{$main::hd}, $hd::store; } $hd::save = $hd::size