in reply to Perl program process

I find very difficult to help you with the few information you gave. So I'll give you a general advice

When I need to use some memory temporarily (say I need temporary variables or data structures or objects...), I usually isolate temporary items as lexical variables inside a block. That way, when the execution of the block comes to end, lexicals disappear -unless you created a closure or circular references or similar things...

For example, say I want to encrypt a password using crypt. The user writes the password on STDIN and I need to do some basic checks before encriptying. If at the end of the process I want to retain just the encrypted password I'd do this way:

my $crypted ; { my $checker = My::Password::Checker->new() ; my $password = <STDIN> ; chomp $password ; die "too short!" unless length $password < 4 ; die "too obvious" if $checker->check_obvious($password) ; # other tests go here... my $salt = generate_random_salt() ; $crypted = crypt($password,$salt) ; } # $password, $salt, $checker and any other variable # declared by my inside the block disappear here :-) # $crypted was declared outside the block, so I can... do_whatever_with($crypted) ;

I hope this helps

Ciao!
--bronto

# Another Perl edition of a song:
# The End, by The Beatles
END {
  $you->take($love) eq $you->made($love) ;
}