Follow-up Comment #7, bug #68136 (group groff):

Turns out my algorithm can be simplified if it transforms 0-9 rather than
skipping them; this eliminates the loop (though does introduce a second
variable, needed since the older perl that gropdf has to support lacks the /r
modifier to tr).

{
    # in perl 5.10+, this could be a "state" variable inside SubTag
    my $subtag_counter = 0;
  
    sub SubTag
    {
        ($res = sprintf ("%06X", $subtag_counter++)) =~ tr/0-9/Q-Z/;
        return($res.'+');
    }
}

This refinement also expands the number of unique 6-character subtags from
~46,000 to ~16,000,000... in case that was a concern. ;-)


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68136>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to