I have moved the variables to the top of the sub as opposed to them being at the begining of the script. Still 4k per message leaks.. I'll keep looking. Thanks for the suggestions though.

the code now looks like the following:-

sub Check_For_Call { my ($dsm,$server,$agt,$inst_det) = @_; my $dbh = (); my $sth = (); my $query = (); $num = (); $dbh = DBI->connect(qq{DBI:CSV:f_dir=$xcall_path}) or die &Debug_L +og("\nDEBUG - Problems Connecting to CSV File\n"); $dbh->{'csv_tables'}->{'Exist'} = { 'file' => 'ExistCalls', 'sep_char' => ';', 'eol' => "\n"}; $query = "SELECT CallNum FROM Exist where Dsm like '$dsm' and Serv +er like '$server' and Agent like '$agt' and Instance_Detail like '$in +st_det'"; #&Debug_Log("SELECT CallNum FROM Exist where Dsm like '$dsm' and S +erver like '$server' and Agent like '$agt' and Instance_Detail like ' +$inst_det'\n"); $sth = $dbh->prepare($query) or &Debug_Log("\nDEBUG - Problems + Preparing the SQL Statement in Check_for_Call\n"); $num = $sth->execute() or &Debug_Log("\nDEBUG - Problems Execu +ting the SQL Statement in Check_for_Call\n"); if (defined $num) { chomp($num); $sth->finish(); $dbh->disconnect(); return ($num); } else { #No Call Number Defined $sth->finish(); $dbh->disconnect(); return (2); } $sth->finish(); $dbh->disconnect(); return(1); }

Update: I have the use strict and use warnings at the begining of my full script at my scratchpad.

-----
Of all the things I've lost in my life, its my mind I miss the most.

In reply to Re: DBD::CSV Memory Leak by AcidHawk
in thread DBD::CSV Memory Leak by AcidHawk

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.