package tahash; use strict; use warnings; use Data::Dumper (); # just for debugging, remove from production code # For historic reasons, the Tie::StdHash class is hidden in Tie::Hash. # So you have to load Tie::Hash instead of Tie::StdHash and set @INC manually. # Otherwise, you could simply do this: #use parent 'Tie::StdHash'; use Tie::Hash (); our @ISA=qw(Tie::StdHash); sub FIRSTKEY { my $self=shift; print "Hey, someone scans my keys!\n"; return $self->SUPER::FIRSTKEY(@_); } sub DESTROY { my $self=shift; print "The object is destroyed...\n"; $self->SUPER::DESTROY(); } 1;