Help for this page

Select Code to Download


  1. or download this
      DB<100> use Hash::MoreUtils qw/safe_reverse/
    
    ...
    
      DB<106> safe_reverse \%h
     => (1, ["a", "b"], 2, "c")
    
  2. or download this
      DB<110> safe_reverse sub { my ($k, $v, $r) = @_; return [ @{$r->{$v}
    +}, $k ] },\%h
     => (1, ["a", "b"], 2, ["c"])