- or download this
my %hash = ( a => 1, b => 2, c => 3 );
my %inverted_hash = reverse %hash;
- or download this
use Data::Dumper;
print Dumper(\(%hash, %inverted_hash));
...
# '3' => 'c',
# '2' => 'b'
# };
- or download this
%hash = ( a => 1, b => 2, c => 2 );
%inverted_hash = reverse %hash;
...
# '1' => 'a',
# '2' => 'c'
# };
- or download this
print "keys were lost during inversion\n"
if keys %inverted_hash < keys %hash;