Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: sort array by date

by BrowserUk (Pope)
on Jan 04, 2007 at 14:43 UTC ( #592954=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
     print for sort qw[ 12 a123 a122 A123 B123 Ab123 aB123 456 1A23 1a23 ]
    +;;
    12          ## ord('1') == 49, ord('2') == 50
    ...
    a122
    a123
    aB123
    
  2. or download this
    print for sort{ $b cmp $a } qw[ 1 10 100 2 20 21 3 300 ];;
    300
    ...
    100
    10
    1
    
  3. or download this
    print for sort{ $b <=> $a } qw[ 1 10 100 2 20 21 3 300 ];
    300
    ...
    3
    2
    1
    
  4. or download this
    print for sort{ 
        substr( $a, 1 ) <=> substr( $b, 1 ) 
    ...
    D222
    A473
    B659
    
  5. or download this
    ## Build an array of anonymous arrays, 
    ## each of which contains the sort field and the original element.
    ...
    print Dumper \@sorted;;
    
    $VAR1 = ['E001','C123','D222','A473','B659'];
    
  6. or download this
    @sorted = map{ 
        $_->[1] 
    ...
    
    print Dumper @sorted;;
    VAR1 = 'E001'; $VAR2 = 'C123'; $VAR3 = 'D222'; $VAR4 = 'A473'; $VAR5 =
    + 'B659';
    
  7. or download this
    print for map{ 
        $_->[2] 
    ...
    A473
    B659
    C659
    
  8. or download this
    print for map{ 
        ## Chop off the bit we added.
    ...
    D222
    A473
    B659
    
  9. or download this
    print for map{ 
        unpack 'x[N] A*', $_ 
    ...
    D222
    A473
    B659
    
  10. or download this
    print for map{ 
        unpack 'x[NA1]A*', $_ 
    ...
    A473
    B659
    C659
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://592954]
help
Chatterbox?
[Eily]: can't you just remote connect to the linux machine ?
[marto]: IIRC the hiemdal suite made life much easier on windows, and people on XDA developers put out released of windows only pages for adb that made it less of a pain
[marto]: Eily you can't remote connect the physical device via USB ;)
[Corion]: Eily: Sure, that's what I do, but some things you need to do on the Android device directly, like when navigating the bootloader :-)
[Eily]: marto you just need a longer cable :P
[Corion]: marto: Yeah, but I'm somewhat wary of installing random USB drivers downloaded from mega.nz , Google Drive or whatever, so Linux wins there due to there being no conflicts and me just having to edit one text file in the worst case, to add the USB vendor
[hippo]: Long USB cable FTW.
[Corion]: Eily: I've thought of that, but I don't like running long cables through the appartment because sooner or later I'll trip over it, pulling at least one device off its stand :)
[marto]: hmm, may have to patch CPAN::Meta to move from search.cpan to metacpan in the META.json/yml files
[Corion]: marto: Heh - it seems that they plan to keep the search.cpan.org links alive for a long time. But still, I plan on moving PM to use/generate the new links

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2018-05-23 09:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?