in reply to key value pair reference?

Do you want to get a magical variable that keeps together a value, its hash key and the hash where they originated from?

package HashTriplet; use strict; sub new { my( $class, %options ) = @_; bless \%options => $class } sub hash { $_[0]->{hash} } sub key { $_[0]->{key} } sub value { my( $self ) = @_; $self->hash->{ $self->key } } 1; package main; use strict; my $myHash = { key => "value" } ; foreach( keys %{ $myHash } ) { doSomething( HashTriplet->new( hash => $myHash, key => $_ )); } sub doSomething { warn $_[0]; warn $_[0]->key; print "key = " . $_[0]->key . "\n"; print( ( $_[0]->value ) . "\n" ) ; print( ( $_[0]->hash )->{ $_[0]->key } . "\n" ) ; } __END__

If you want the additional syntax trickery to make Perl treat key $x; as $x->key you will need to fiddle around a bit with prototypes, but as I'm a bit unclear on the purpose of your data structure, I'll just stop here.