I run into this problem - i have ascript that deals with a decent-size array of arrays - about 160,000 by 300. i load it from a file, do some magic on it (parsing,searchign for certain records and deleting the rows that i need), and then write it into another output file. The problem is that, judging from the messages on the screen it takes few hours to close the filehandle for one reason or another. What am i doing wrong? Any help is appreciated. TS
open (INFILEHANDLE, "<:crlf", $detail_file_in) or die "Can't open $de +tail_file_in! \n"; $counter = 0; while ($line = <INFILEHANDLE>) { chomp $line; @{$in_array[$counter]} = split($in_delim, $line); $counter++; } close INFILEHANDLE; #process the details file $target = 'details file'; patch_stockfiles(*LOGFILEHANDLE, *FILTERLOGFILEHANDLE, \@in_array, $ta +rget); delete_duplicates(*LOGFILEHANDLE, *FILTERLOGFILEHANDLE, \@in_array, $t +arget); fix_format(*LOGFILEHANDLE, *FILTERLOGFILEHANDLE, \@in_array, $target); ($sec,$min,$hour,$day,$mon,$year) = (localtime)[0..5]; $date = sprintf "%d%02d%02d",$year+1900,$mon+1,$day; $preform_date = $date . "\t" . $hour . ":" . $min . ":" . $sec; print LOGFILEHANDLE $preform_date . "\tWriting Detail File..." +; print $preform_date . "\tWriting Detail File..." +; #print into a file open (OUTFILEHANDLE, ">" . $detail_file) or die "Can't open $detail_fi +le \n"; for ($counter = 0; $counter <= $#in_array; $counter++) { print OUTFILEHANDLE join($in_delim, @{$in_array[$counter]}) . "\n" +; } @in_array = (); print LOGFILEHANDLE "Ok\n"; print "Ok\n"; close OUTFILEHANDLE;

In reply to Perl Filehandle? by Smersh2000

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.