my $self = shift; foreach my $key (keys(%{$self})) { delete $self->{$key}; } #### package Celebrity; use strict; use warnings; my $security = Guard->new; while(1) { sleep(3600); $security->check; } package Guard; use strict; use warnings; sub new { my $class = shift; my $self = {}; bless($self, $class); $self->{'Hours_on_the_job'} = 0; return $self; } sub check { #crawl through the bushes, meet people, shoot them #collect all sorts of data $self->{'Data'} = "blahdiblah"; $self->{'Moredata'} = "dumdidum"; $self->{'Yetmoredata'} = "whatever dude"; $self->{'Hours_on_the_job'} += 1; if($self->{'Hours_on_the_job'} == 6) { #long live the union! #file an extensive report, go home #new guard takes over * cleaning out the object would happen here * $self->{'Hours_on_the_job') = 0; } }