use strict; use warnings; use List::Util qw(reduce); my $maxkey = reduce { $hash{$a} > $hash{$b} ? $a : $b } keys %hash; my $minkey = reduce { $hash{$a} < $hash{$b} ? $a : $b } keys %hash; @hash{$minkey,$maxkey} = @hash{$maxkey,$minkey};
Makeshifts last the longest.
In reply to Re: Interchanging hash values (List::Util)
by Aristotle
in thread Interchanging hash values
by mjab
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |