[EMAIL PROTECTED] wrote:
>
When I do string comparisons in perl the strings seem to ignore the
embedded hyphens.
>
I want to sort strings assuming the 'dictionary' order of the chars is
ASCII order: hypen, 0-9, A-Z.
>
It appears linux sort also has the problem (LC_ALL is blank).
>
Any ideas? I want to avoid a brute force char by char sort if possible.

It appears that your problem is more complex than you have diagnosed.
Look:

use strict;
use warnings;

use List::Util qw/shuffle/;

my @list = shuffle ('-', '0' .. '9', 'A' .. 'Z', 'a' .. 'z');

print join(',', @list), "\n";
print join(',', sort @list), "\n";;

**OUTPUT**

9,L,c,1,M,2,m,J,5,t,8,y,W,N,k,h,Y,b,f,E,q,P,X,-,Z,B,I,K,4,V,e,F,x,g,3,H,u,v,R,w,r,T,d,O,G,7,U,l,z,6,a,s,A,p,0,o,C,i,n,Q,j,D,S
-,0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z


Can you please show us the code and data that is causing you problems?

Rob

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


Reply via email to