@reduced_protein = shift (\@reduced_protein,($x2-$x1),($y2-$y1),($z2-$z1)); # reduced protein is 2D array with each line having some properties about the protein. The shift function just shifts the coordinates of the all lines thus the protein (given below) sub shift { my ($reduced_protein, $shift_x, $shift_y, $shift_z); my @reduced_protein=@$reduced_protein; my $index1; my $protein_length=findColumnLength(@reduced_protein); for ... (shifting operation) return @reduced_protein; }