On Thu, 10 Oct 2019 23:18:29 +0200 gregor herrmann <gre...@debian.org> wrote:
> Looking a bit further, this doesn't seem to affect only the
> autopkgtest because:
> % grep -r '\$\[' | wc -l
> 1099
> I mean, it might be possible to just remove '$[ = 1;' eleven hundred
> times and see what happens if all arrays are based on 0 instead of 1
> but I don't know.
> (I also noted that prof.pl had $[ set although I haven't seen an
> array in the whole script …)

Another interesting count is the number of times a numeric index is used with 
an array (array ref are not used in there):

$ ack '\$\w+\[\d' | wc -l

To be compared with the number of times an array is used with a variable:
$ ack '\$\w+(->)?\[\$' |wc -l

Fortunately, these should not be changed. But how these variables are 
initialized may be a problem

For instance $it and $ct variable are often used as iterator. Let's see how 
many times they are initialized with 1 or with a digit:

$ ack '\$(it|ct)\w+\s*=1\b'  | wc -l

$ ack '\$(it|ct)\w+\s*=\d' | wc -l

For this to improve, we'd need a set of high level tests provided by debian-
med or upstream team.

Then some change could be done with a script (removed $[=1 lines and decrement 
all numeric indexes)

Dealing with the remaining will unfortunately be a manual task.



Reply via email to