in reply to Sort a long list of hosts by domain (code)

I have a feeling this has a speed increase. It's a Guttman-Rosler Transform, which means that the sorting is done by the native sort(). Also, I only reverse each key twice, whereas your method is probably doing a lot more reversing.
@by_domain = map { scalar reverse } sort map { scalar reverse } keys %hosts;


japhy -- Perl and Regex Hacker

Replies are listed 'Best First'.
Re: Re: Sort a long list of hosts by domain
by John M. Dlugosz (Monsignor) on Jun 25, 2001 at 22:04 UTC
    How about a pointer to Guttman-Rosler Transform, or a list of such transforms in general? I assume this will be in your book?
      My book is regex-related. Uri Guttman and/or Larry Rosler has information about the GRT; try this URL. I do have some sorting stuff online at my web site.

      japhy -- Perl and Regex Hacker