... # the array will be modified 'in place', so theres # no necessity to copy stuff around Shift( \@reduced_protein, $x2-$x1, $y2-$y1, $z2-$z1 ); ... sub Shift { my ($rp_ref, $x, $y, $z) = @_; # traditional way to feed a sub my $index1; # the expression @$array_ref expands a reference to a list my $protein_length = findColumnLength(@$rp_ref); for (shifting operation) { ... # instead of: $reduced_protein[i], # you say: $rp_ref->[i] ... } # no need to return anything, the original array is # already modified }