use strict;
use warnings;

my %h = ( a => { b=> 1}, aa=> {bb=>2, }, );

sub where_key {
    my $ref = shift;

    while ( my ($key, $value) = each %h ) {
        $ref eq $value
             and return $key;
    }

    return;
}

my $k = where_key( $h{aa} );
print $k;
exit;


--
Moscow.pm mailing list
[email protected] | http://moscow.pm.org

Ответить