Hello List,
I am trying to sort a hash of arrays ( example below: )
I would the sort to sort in ascending order the first index of the array
then the second index of the array.
So in this example the arrays would sort to:
97,2,120,65
219,1,30,33
280,3,230,90
462,2,270,65
$VAR1 = {
'
On Tue, 21 Aug 2012 15:05:33 -0500
Chris Stinemetz wrote:
> I am trying to sort a hash of arrays ( example below: )
>
> I would the sort to sort in ascending order the first index of the
> array then the second index of the array.
What have you tried so far? Can we see the code?
--
Just my 0
On Tue, Aug 21, 2012 at 3:11 PM, Shawn H Corey wrote:
> On Tue, 21 Aug 2012 15:05:33 -0500
> Chris Stinemetz wrote:
>
> > I am trying to sort a hash of arrays ( example below: )
> >
> > I would the sort to sort in ascending order the first index of the
> > array then the second index of the array
On Aug 21, 2012, at 1:05 PM, Chris Stinemetz wrote:
> Hello List,
>
> I am trying to sort a hash of arrays ( example below: )
>
> I would the sort to sort in ascending order the first index of the array
> then the second index of the array.
I believe you mean "first element" rather than "first
On Aug 21, 2012, at 1:23 PM, Jim Gibson wrote:
>
> On Aug 21, 2012, at 1:05 PM, Chris Stinemetz wrote:
>
>> Hello List,
>>
>> I am trying to sort a hash of arrays ( example below: )
>>
>> I would the sort to sort in ascending order the first index of the array
>> then the second index of the
I will leave it to you to write an actual program incorporating these
> ideas.
>
> Thank you Jim for the excelent explanation.
This seems to do the trick.
foreach my $cellNo ( sort { $hash{$a}->[0] <=> $hash{$b}->[0] ||
$hash{$a}->[1] <=> $hash{$b}->[1] } keys %hash ) {
print join( "\0", @{
On 21/08/12 22:05, Chris Stinemetz wrote:
> Hello List,
>
> I am trying to sort a hash of arrays ( example below: )
>
> I would the sort to sort in ascending order the first index of the array
> then the second index of the array.
>
> So in this example the arrays would sort to:
>
> 97,2,120,65
>
On 08/21/2012 05:33 PM, Eduardo wrote:
On 21/08/12 22:05, Chris Stinemetz wrote:
Hello List,
I am trying to sort a hash of arrays ( example below: )
I would the sort to sort in ascending order the first index of the array
then the second index of the array.
So in this example the arrays wou
On 22/08/12 00:35, Uri Guttman wrote:
> On 08/21/2012 05:33 PM, Eduardo wrote:
>> On 21/08/12 22:05, Chris Stinemetz wrote:
>>> Hello List,
>>>
>>> I am trying to sort a hash of arrays ( example below: )
>>>
>>> I would the sort to sort in ascending order the first index of the
>>> array
>>> then
On 08/21/2012 08:29 PM, Eduardo wrote:
On 22/08/12 00:35, Uri Guttman wrote:
my %cache = ();
foreach ( keys %$hash )
{
my ( $naa, $nab ) = $_ =~ m|^(\d+)-(\d+)|;
$cache{ ($naa * 100 + $nab ) } = $_;
}
that is a variant of the orcish manoever which is supported by sort::maker.
fore
10 matches
Mail list logo