in reply to Re^3: Print to specific line
in thread Print to specific line

Hm, agreed, but the OP did not say there were going to be empty slots, and it seems rather unlikely from his description of the problem.

But even if such is the case, still, there is no need for duplicating the data.

My view is that using an array to store the data is the simplest choice. But I would still add code to prevent spurious warnings for undefined values, for example something like:

for my $i (0..$#array) { print defined $array[$i] ? "$array[$i]\n" : "\n"; }
But even with a hash, it is quite simple to do more or less the same thing:
for my $i (0..$max_hash_key) { print defined $hash{$i} ? "$hash{$i}\n" : "\n"; }