Re: Problem sorting hash

2007-05-04 Thread Martin Barth
On Fri, 4 May 2007 16:17:35 +0200 [EMAIL PROTECTED] wrote: > On Fri, May 04, 2007 at 07:36:57PM +0800, Jeff Pang wrote: > > > Since you've got the sorted keys,can't you access the full hash? > > Well, it works this way -- thanks! > > But I wonder why it's not possible to sort a hash in a more i

Re: Problem sorting hash

2007-05-04 Thread leslie . polzer
On Fri, May 04, 2007 at 07:36:57PM +0800, Jeff Pang wrote: > Since you've got the sorted keys,can't you access the full hash? Well, it works this way -- thanks! But I wonder why it's not possible to sort a hash in a more intuitive way... Leslie -- Personal homepage: https://viridian.dnsalia

Re: Problem sorting hash

2007-05-04 Thread John W. Krahn
[EMAIL PROTECTED] wrote: > On Fri, May 04, 2007 at 04:05:46AM -0700, John W. Krahn wrote: > >>my @toc_keys = sort { $toc{ $a }{ lines } <=> $toc{ $b }{ lines } } keys %toc; > > I don't think this will do what I want. I want the full hash structure > preserved, not an array of the keys sorted by

Re: Problem sorting hash

2007-05-04 Thread Jeff Pang
2007/5/4, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: On Fri, May 04, 2007 at 04:05:46AM -0700, John W. Krahn wrote: > my @toc_keys = sort { $toc{ $a }{ lines } <=> $toc{ $b }{ lines } } keys %toc; I don't think this will do what I want. I want the full hash structure preserved, not an array of the

Re: Problem sorting hash

2007-05-04 Thread leslie . polzer
On Fri, May 04, 2007 at 04:05:46AM -0700, John W. Krahn wrote: > my @toc_keys = sort { $toc{ $a }{ lines } <=> $toc{ $b }{ lines } } keys %toc; I don't think this will do what I want. I want the full hash structure preserved, not an array of the keys sorted by 'lines'... Leslie -- Personal

Re: Problem sorting hash

2007-05-04 Thread John W. Krahn
[EMAIL PROTECTED] wrote: > Hello guys, Hello, > I can't find the solution for sorting a two-dimensional hash. > I'm sure some of you can help me. perldoc -q "How do I sort a hash" > The first dimension of the hash has filenames in it, the second > consists of two keys, 'data' and 'lines'. > >

Re: Problem sorting hash

2007-05-04 Thread Jeff Pang
2007/5/4, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: Hello guys, I can't find the solution for sorting a two-dimensional hash. I'm sure some of you can help me. The first dimension of the hash has filenames in it, the second consists of two keys, 'data' and 'lines'. I want to sort the whole th