in reply to Hash or not?

Ouch. Repeated code is usually a sign that you need abstraction or a loop, or a better datastructure. Does this (untested) code replace the first half?

my @t = ( 11111, $datapoint[$kk][1], $datapoint[$kk][2], 0, 0, 99999, 1111, ); my $point3 = $blocks[ $datapoint[ $kk ][ 3 ] ]; for my $rr ( ($jj + 1) .. $#$point3 ) { (@t, @{ $point3 }[ 0 .. 6 ]) = (@{ $point3 }[ 0 .. 6 ], @t); } push @$point3, \@t;

Update: demerphq caught a missing square bracket