in reply to Re: Getting Max Value from Different Hashes
in thread Getting Max Value from Different Hashes
Corion, your method is straightforward but suffers because it makes a copy of every value at once. You could still use max() but only have one hash copy present at a time just by switching to reduce().
my @hashes = ( $hash_w, $hash_x, $hash_y, $hash_z ); my $max = max( values %{shift @hashes } ); $max = reduce { max( $_[0], values %{$_[1]} ) } @hashes;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Getting Max Value from Different Hashes
by polettix (Vicar) on Aug 01, 2005 at 15:56 UTC | |
by diotalevi (Canon) on Aug 01, 2005 at 16:03 UTC | |
by polettix (Vicar) on Aug 01, 2005 at 16:13 UTC |