It is awkward to implement an algorithm in Perl when the algorithm is specified with array indices starting at 1. We do have the module
Array::Base to address this problem. Its use is considered poor style in part, because it breaks common idioms. Remember this problem has a flip-side when using a language such as FORTRAN and your spec uses 0 based arrays.