As was evident from the Recursive implementation, there was tail recursion, which is both redundant & inefficient. Tail recursion must always be replaced with a more efficient, easier to comprehend iterative counter-part, as you have done here.

Only, you have done it in Perl - a language which I do not know much about - so I got to learn the basics of a new language as well!