Monks, Need help where my perl script stops writing data to a file. Script splits a 700 MB into a file of 30K lines each into a directory.
Files in the directory are read one after another , each line in each file is processed , converted and outputed to another file which is approximately 13MB size. (reason:13 MB file is inputted to a system which works optimally @ 13 MB Size).
Script stops processing after 138 files, specifically fails when print FileHndlr, $formattedline
print FileHndlr , $formattedline or warn 'unable to write!';
fails after 138th file. based on feedback from perl tutorials , $!++ was done before the while in order to do autoflush
always fails @ 138 * 13 MB each. Please advice on how i should approach this issue and how to resolve this. my script looks something like
$|+;; my @InpFiles = glob (*.dat"); foreach my $inpfile (@InpFiles) { my $outfilename; my $outputfile = ""; open(HNDL, "$inpfile"); open $outfilename, ">", $outputfile; $|++; while(my $tmpline = <HNDL>){ print $outputfile "$parsedstring\n" or warn 'couldnot writ +e to file'; print $outputfile "$parsedsecondstring\n" or warn 'couldno +t write to file'; } } $|++; close( HNDL ); close( $outfilename ); undef $outfilename; }

In reply to Perl - Linux - Unable to Write Files by txfun

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.