#or should it be 0..$total_elements?? for my $x (1..$total_elements+1) { }