http://qs321.pair.com?node_id=149343

Fool on the Hill has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I would really like to be able to get a variable name from a reference so that I could do things like this:
#!/usr/bin/perl -w use strict; my %hash1=("A"=>1); my %hash2=("B"=>2); foreach my $hashref (\%hash1,\%hash2) { print "$hashref:",ref($hashref),":",(join ",",sort keys %{$hashref}) +,"\n";
Output
HASH(0x2002a3d0):HASH:A HASH(0x2002a418):HASH:B
But I would really like to display the name of the hash that is referenced like this:
hash1:A hash2:B
Cheers.