DB<131> sub invert { my %h=@_; my %h2; while ( my ($k,$v) = each %h ) { push @{ $h2{$_} } , $k for @$v; } return %h2; } DB<134> %t = (1 => ["e", "c", "a"], 2 => ["b", "d", "f"], 3=>[a] ) => (1, ["e", "c", "a"], 2, ["b", "d", "f"], 3, ["a"]) DB<135> invert %t => ("e", [1], "c", [1], "a", [1, 3], "b", [2], "d", [2], "f", [2]) DB<136> invert invert %t => (1, ["e", "c", "a"], 3, ["a"], 2, ["b", "d", "f"])