Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: sorting with substrings

by borisz (Canon)
on May 25, 2006 at 22:08 UTC ( [id://551720]=note: print w/replies, xml ) Need Help??


in reply to sorting with substrings

my @q = qw(workstation_1_1 workstation_1_2 voiceserver_1_2 voiceserver_1_1); @q = map { join '_', @$_ } sort { $a->[1] <=> $b->[1] or $a->[2] <=> $b->[2] or $a->[0] cmp $b->[0] } map { [ split /_/ ] } @q; use Data::Dumper; print Dumper( \@q ); __OUTPUT__ 'voiceserver_1_1', 'workstation_1_1', 'voiceserver_1_2', 'workstation_1_2'
Boris

Replies are listed 'Best First'.
Re^2: sorting with substrings
by JFarr (Sexton) on May 25, 2006 at 22:15 UTC
    Thank both of you for you help.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-19 19:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found