On Oct 3, Xavier Noria said:

On Oct 3, 2005, at 18:16, Jeff 'japhy' Pinyan wrote:

  my @sorted =
    map { tr/123/QBZ/; $_ }
    sort
    map { tr/QBZ/123/; $_ }
    @data;

There's a potential gotcha there: since all Qs and Bs are being swapped lexicographic order after the first character is also changed. That might not be an issue though.

My code relies on the sample data being indicative of the rest of the data, meaning there'll only be a capital Q, B, or Z at the beginning of the string.

--
Jeff "japhy" Pinyan        %  How can we ever be the sold short or
RPI Acacia Brother #734    %  the cheated, we who for every service
http://www.perlmonks.org/  %  have long ago been overpaid?
http://princeton.pm.org/   %    -- Meister Eckhart

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to