I've got an array full of hashrefs:
my @a = ( {N => '10.1.2.1'},
          {N => '10.1.9.1'},
          {N => '10.3.5.1'},
          {N => '10.1.1.3'},
         );


I want to sort this array, and print.  I expect the output resemble:

10.1.1.3
10.1.2.1
10.1.9.1
10.3.5.1


I've fumbled with this for a while, and the closest I've come to is:
my @s = map { $_ -> [0] }
         sort { $a->[0] <=> $b->[0] ||
                $a->[1] <=> $b->[1] ||
                $a->[2] <=> $b->[2] ||
                $a->[3] <=> $b->[3] }
          map { [ $_, split /\./ ] } $a->{N};



but that simply fails to produce.  I've replaced $a->{N} with multiple
variations, but I'm confused.

If someone can give me code, I'd also appreciate a clue.

thanks,


-- 

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