>"David L. Nicol" <[EMAIL PROTECTED]> writes: >> Piers Cawley <[EMAIL PROTECTED]> writes: >>> [EMAIL PROTECTED] (Yitzchak Scott-Thoennes) writes: >>> >>> > $srt =~ tr/0-9a-z\xe9/a-jA-ZE/; # uc & sort nums after letters >> >> `10' is going to sort before `2' with that rule. Having done the whole >> bitter experience thing with this, may I suggest: >> >> $srt =~ s/(\d+)/unpack("B32", pack("N",$1))/eg >> >> Which will give you nice 32 bit binary representations of your >> numbers, which have leading zeros and will sort properly via cmp. >> >> If you want a sample of the pain I had working that out, you >> should've been at my 12 step perl session at YAPC::Europe. > > Is there a perl6 sort committee yet? AFter reading Cawley's > method here, I wonder if using it we could make radix-sorts the > default sort method. Er... the point behind changing numbers to binary strings was emphatically not so that they could be sorted by a Radix method, but to ensure that numbers within text would sort correctly: qw(A1 A2 A3 A10) instead of qw(A1 A10 A2 A3)...
- Re: [Fwd: Re: [FWP] sorting text in human-order] John Porter
- Re: [Fwd: Re: [FWP] sorting text in human-order] Nathan Torkington
- Re: [Fwd: Re: [FWP] sorting text in human-ord... John Porter
- Re: [Fwd: Re: [FWP] sorting text in human-order] Jarkko Hietaniemi
- Re: [Fwd: Re: [FWP] sorting text in human-order] Dan Sugalski
- Re: [Fwd: Re: [FWP] sorting text in human-order] John Porter
- Re: [Fwd: Re: [FWP] sorting text in human-ord... Jarkko Hietaniemi
- Re: [Fwd: Re: [FWP] sorting text in human... John Porter
- Re: [Fwd: Re: [FWP] sorting text in h... Peter Scott
- Re: [Fwd: Re: [FWP] sorting text in human-ord... Dan Sugalski
- Re: [Fwd: Re: [FWP] sorting text in human-order] Piers Cawley
- Re: [Fwd: Re: [FWP] sorting text in human-order] David L. Nicol
- Re: [Fwd: Re: [FWP] sorting text in human-ord... Jarkko Hietaniemi
- Re: [Fwd: Re: [FWP] sorting text in human... Jonathan Scott Duff
- Re: [Fwd: Re: [FWP] sorting text in h... Jarkko Hietaniemi
- Re: [Fwd: Re: [FWP] sorting text... Jonathan Scott Duff
- Re: [Fwd: Re: [FWP] sorting ... Uri Guttman
- Re: [Fwd: Re: [FWP] sorting text in human... David L. Nicol
- Re: [FWP] sorting text in human-order David L. Nicol
- Re: [FWP] sorting text in human-order Piers Cawley
- Re: [FWP] sorting text in human-order Piers Cawley