Clovis_Sangrail has asked for the wisdom of the Perl Monks concerning the following question:
Hello Perl Monks:
I am using a Perl CGI script to display/edit a file that has data lines like:
5200 "AMX" gtm_dist-V5.4-002B 5600 "TIAA CREFF" gtm_dist-V5.4-001 5995 "Morgan Stanley" gtm_dist-V5.4-001
I match each data line against:
/^(\d\d\d\d)\s+("[^"]+")\s+(\S+)$/and save in a hash whose key is the 1st field and whose value is a reference to an anonymous array of the 2nd & 3rd fields, ex:
$bkarr{$1} = [ $2 , $3 ];Should the user choose to delete a line I just delete the hash entry that he specifies via:
delete $kbarr{$K};before writing out the file. It works, but am I creating a memory leak by doing this? Do I have to somehow clean up the two-entry array whose reference I am holding in the hash entry? Thanks for any advice.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Possible Memory Leak?
by davido (Cardinal) on Apr 26, 2013 at 19:33 UTC | |
|
Re: Possible Memory Leak?
by BrowserUk (Patriarch) on Apr 26, 2013 at 19:28 UTC |