in reply to renumber entries in column?
If they are already sequential, subtract 8.
print $columns[$n]-8 ,"\n";
Or adding a counter is reasonable. Since you don't change $n, you could repurpose that as your counter and change the data you started with.
#for testing: $columns[1] = $n++; print "$columns[1] \n"; # Print the whole array with new numbering print "@columns\n"
or without changing the original data, use the postincrement operator
#for testing print $n++,"\n";
|
|---|