The problem is you recurs 1 too many times. However, there is a swathe of smelly areas in your code. Take a look at the following code to see how it can be improved in various ways. You may want to ask questions about why various things have been done or how they work.
use strict;
use warnings;
use 5.010;
my @inputArray = (1, 2, 3, 4, 5, 6, 7, 8);
traverseArray(\@inputArray, 0);
sub traverseArray {
my ($aRef, $index) = @_;
return if $index >= @$aRef;
print "$aRef->[$index]\n";
traverseArray($aRef, $index + 1);
}
Premature optimization is the root of all job security