Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Sorting (GRT) and locale issues

by chrism01 (Friar)
on Nov 15, 2007 at 06:14 UTC ( [id://650929]=note: print w/replies, xml ) Need Help??


in reply to Sorting (GRT) and locale issues

I was going to ask if looks like there's something wrong with my locale: it should be Australia (ideally), prob defaults to US, but in either case

substr( $_, 1 ), substr( $_, 0, 1 ), $_ } on A437 should give
437 A A437
ie the nums are at the front regardless. The top code just shows that lower/uppercase is mixed or upper then lower, but nums are always first...

Sorry if it seems I'm being obtuse; I REALLY want to understand this.

Chris

Replies are listed 'Best First'.
Re^2: Sorting (GRT) and locale issues
by ikegami (Patriarch) on Nov 15, 2007 at 06:28 UTC
    You don't pass '437 A A437', you pass the result of pack('N A1 A*', '437', 'A', 'A437').
    use Data::Dumper qw( Dumper ); for (qw[ A066 A067 A098 A099 ]) { my $coded = pack('N A1 A*', substr($_, 1), substr($_, 0, 1), $_); local $Data::Dumper::Useqq = 1; local $Data::Dumper::Terse = 1; print("$_: ", Dumper($coded)); }
    A066: "\0\0\0BAA066" A067: "\0\0\0CAA067" A098: "\0\0\0bAA098" A099: "\0\0\0cAA099"

    PS - Why do you keep replying to your node?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://650929]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-23 07:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found