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) ;
}


In reply to Re: Perl program process by bronto
in thread Perl program process by venki

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.