http://www.perlmonks.org?node_id=1232718


in reply to Re: Max value
in thread Max value

Another one variant:
use strict; use warnings; my %hash_name = ( a => 1, b => 2, c => 3, d => 3 ); my %keys_of_max; my $key_of_max; my $numeric_cmp_result; $numeric_cmp_result = defined $key_of_max ? ( eval join '<=>', map { $hash_name{ $_ } } $_, $key_of_max +) : 1 xor $numeric_cmp_result > 0 and %keys_of_max = ( $key_of_max = $_ +=> 1 ) xor ( $numeric_cmp_result or $keys_of_max{ $_ } = 1 ) for keys %hash_name; print sort keys %keys_of_max;
OUTPUT:
Useless use of logical xor in void context at perlmonks_Max_Value.pl l +ine 26. cd