On 8/9/2005 6:26 AM, Paul Johnson wrote:
> my @s = map  { $_ -> [0] }
>         sort { $a->[0] <=> $b->[0] ||
>                $a->[1] <=> $b->[1] ||
>                $a->[2] <=> $b->[2] ||
>                $a->[3] <=> $b->[3] }
>         map  { [ $_, split /\./ ] }
>         map  { $_->{N} } @a;

You clearly solved the problem that I asked, but... :)

I've apparently dumbed down my code and question a bit too much:  I have
multiple hashrefs in each element of the array, and I need the resulting
sorted array to contain all the data in the original array, simply
sorted by the value of N.


my @a = ( {N => '10.1.2.1', ID => 1},
          {N => '10.1.9.1', ID => 2},
          {N => '10.3.5.1', ID => 3},
          {N => '10.1.1.3', ID => 4},
         );

When I use your suggested code, only the value of N seems to be in @s.

Thanks for your help, Paul.


-- 

Jeremy Kister
http://jeremy.kister.net./

-- 
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