package Data::CryptRecord; BEGIN { use strict; [ ... ] our %ENGINES; } sub register { ... } # adds to the %ENGINES hash # List what's in the hash sub list_engines { my $self = shift; my @eng; while( my ($k, $v) = each(%ENGINES)){ push @eng, $v->{'name'}; } return @eng; } # Chose a distinct crypt method for this instance # Lot's of list_engines included for debugging sub set_engine { my ($self, $name) = @_; $name = uc($name); print "Enter set_engine (" . scalar $self->list_engines . ")\n"; while( my ($k, $v) = each(%ENGINES)){ next unless(uc($v->{'name'}) eq $name); $self->{'enc_type'} = $k; print "Exit OK set_engine (" . scalar $self->list_engines . ")\n"; return 0; } print "Exit fail set_engine (" . scalar $self->list_engines . ")\n"; return -1; } #### (not shown, at the end of the CTOR) Blessed List(1) Enter set_engine(1) Exit OK set_engine (0) after set_list (1) (This is another list_engines called later in the program) #### export PERLDB_OPTS='TTY=/dev/pts/2' perl -d ./myprg.pl