in reply to HoH problem
$ perl -e' my %hoh = ( FILENAME1 => { A => { weight => 3000, intensity => 2 }, B => { weight => 4000, intensity => 3 } }, FILENAME2 => { D => { weight => 2000, intensity => 7 }, C => { weight => 5000, intensity => 3 } }, FILENAME3 => { C => { weight => 1000, intensity => 4 }, A => { weight => 6000, intensity => 3 } }, ); print map "weight: $_->[0] intensity: $_->[1] Filename: $_->[2]\n", map [ unpack q[NNA*], $_ ], sort map { my $file = $_; map pack( q[NNA*], @{$hoh{$file}{$_}}{qw/weight intensity/}, + $file ), keys %{ $hoh{ $file } } } keys %hoh; ' weight: 1000 intensity: 4 Filename: FILENAME3 weight: 2000 intensity: 7 Filename: FILENAME2 weight: 3000 intensity: 2 Filename: FILENAME1 weight: 4000 intensity: 3 Filename: FILENAME1 weight: 5000 intensity: 3 Filename: FILENAME2 weight: 6000 intensity: 3 Filename: FILENAME3
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: HoH problem
by johngg (Canon) on Nov 07, 2006 at 15:16 UTC |