Use this . I think you wud do better later to move the sort function to
a seperate sub
foreach $key (sort {
($$h{$a}{taste} eq $$h{$b}{taste} ) ? $$h{$a}{name} cmp
$$h{$b}{name}: $$h{$a}{taste} \cmp $$h{$b}{taste}
} (keys %$h)) {
print "$key \n";
}
Jeff Aa wrote:
> Folks,
>
> -Original Message-
> From: Ramprasad A Padmanabhan [mailto:[EMAIL PROTECTED]]
> Sent: 17 September 2002 14:44
> To: [EMAIL PROTECTED]; Jeff Aa
> Cc: [EMAIL PROTECTED]
> Subject: Re: sorting a hash - multiple key fields
>
>
> Use this . I think you wud
Jeff Aa wrote:
> Folks,
>
> I want to sort my masked hashes into neat little piles for easier
> digestion:
> Please note this is _example_ data 8-)
>
> my $h = {
> a => { name => 'apple', taste => 3 },
> b => { name => 'peach', taste => 2 },
> c => { name => 'banana', taste => 2 },
> }
>
Thanks for the response - some questions on your recommendation below:
-Original Message-
From: david [mailto:[EMAIL PROTECTED]]
Sent: 17 September 2002 19:06
To: [EMAIL PROTECTED]
Subject: Re: sorting a hash - multiple key fields
> the return statment is uneccessary. try someth
Jeff wrote:
> Thanks for the response - some questions on your recommendation below:
>
> -Original Message-
> From: david [mailto:[EMAIL PROTECTED]]
> Sent: 17 September 2002 19:06
> To: [EMAIL PROTECTED]
> Subject: Re: sorting a hash - multiple key fields
>
&
On Tue, 2002-09-17 at 19:58, Jeff AA wrote:
>
> > -Original Message-
> > From: Ramprasad A Padmanabhan [mailto:[EMAIL PROTECTED]]
> > Sent: 17 September 2002 14:44
> > To: [EMAIL PROTECTED]; Jeff Aa
> > Cc: [EMAIL PROTECTED]
> > Subject: R