in reply to YAJAPH

$q is used to index the data array @d to select which character is printed.

How is $q computed?