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.