in reply to Interchanging hash values
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Interchanging hash values
by BrowserUk (Patriarch) on Apr 21, 2003 at 04:50 UTC | |
by Aristotle (Chancellor) on Apr 21, 2003 at 11:39 UTC |