Mine works fine..
#!/usr/bin/perl -w use strict; my $self = {}; $self->{data} = './biglog.log'; $self->{process} = 1; my $increment = 1000000; #For this example $$config{blocksize} == 550 # my $blocksize = 550; my $startblock = 1; my $records = int($increment / $blocksize); my $bytecnt = $blocksize * $records; #After caluclations this prints out as 999900 print "bytecnt[$bytecnt]\n"; my $file = 0; open PARENT, $$self{data} or die "Cannot open [$$self{data}] for i +ncremental parsing\n"; while(1){ $file++; my $data = ""; if($file == 1){ read(PARENT, $data, $startblock); read(PARENT, $data, $bytecnt); open(FILE, ">tmp\\$$self{process}".sprintf("%02d", $file). +".dat") or die "Cannot open tmp\\$$self{process}".sprintf( +"%02d", $file).".dat for incremental writing\n"; print FILE $data; close(FILE); next; } read(PARENT, $data, $bytecnt); open(FILE, ">tmp\\$$self{process}".sprintf("%02d", $file).".da +t") or die "Cannot open tmp\\$$self{process}".sprintf("%02d", +$file).".dat for incremental writing\n"; print FILE $data; close(FILE); if(eof(PARENT)){ last; } } close(PARENT); die;
I get
-rw-r--r-- 1 loot poot 6056869 May 30 10:48 biglog.log
-rw-r--r-- 1 loot poot    1425 May 30 10:51 incspl.pl
-rw-r--r-- 1 loot poot  999900 May 30 10:52 tmp\101.dat
-rw-r--r-- 1 loot poot  999900 May 30 10:52 tmp\102.dat
-rw-r--r-- 1 loot poot  999900 May 30 10:52 tmp\103.dat
-rw-r--r-- 1 loot poot  999900 May 30 10:52 tmp\104.dat
-rw-r--r-- 1 loot poot  999900 May 30 10:52 tmp\105.dat
-rw-r--r-- 1 loot poot  999900 May 30 10:52 tmp\106.dat
-rw-r--r-- 1 loot poot   57468 May 30 10:52 tmp\107.dat
Your problem must be the config??.. (Oh no.. could it be because you're using windoz some funny filesystem- like.. ?!?!)

In reply to Re: Unexpected File Results by leocharre
in thread Unexpected File Results by Grundle

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.