A very good lesson to learn Schwartzian Transform.
Thanks Gunnar!

--
Regards,
Edward WIJAYA
SINGAPORE

On Sun, 28 Nov 2004 09:36:26 +0100, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote:


 I have code the performs the task, but it's a Swartzian Transform, a
temporary array, another swartz transform, and just feels icky.
 any suggestions to pretty this bloat ?

my @unsorted = ( '5 127.0.0.1', '10 127.0.1.1', '5 27.0.0.1', '6 10.0.0.1', '1 17.0.0.1', '5 209.0.0.1', );

     my @sorted = map { $_->[0] } sort {
                          $a->[1] <=> $b->[1]
                                   ||
                          $a->[2] <=> $b->[2]
                                   ||
                          $a->[3] <=> $b->[3]
                                   ||
                          $a->[4] <=> $b->[4]
                                   ||
                          $a->[5] <=> $b->[5]
     } map { [ $_, split /[. ]/ ] } @unsorted;





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




Reply via email to