in reply to Getting a variable name from a reference

You can use symbolic references:

our %hash1 = ("A"=>1); our %hash2 = ("B"=>2); foreach my $hashref ('hash1', 'hash2') { no strict 'refs'; print "$hashref:",(join ",",sort keys %{$hashref}),"\n"; }

Note that it won't work on variables declared with my(). From perlref:

Only package variables (globals, even if localized) are visible to symbolic references. Lexical variables (declared with my()) aren't in a symbol table, and thus are invisible to this mechanism.