in reply to File splitting script

I haven't looked deeper, but some comments may help you find the offending code:

And the error you're getting should be related to this statement:

$fsize-=$size;
that will produce a negative size eventually if $fsize is not a multiple of $size.

Update: as pointed by johngg, I messed up things thinking about a pair read/write when there's only sysread/syswrite in Perl. print is just fine as a counterpart of read.

Replies are listed 'Best First'.
Re^2: File splitting script
by johngg (Canon) on Jan 25, 2007 at 20:45 UTC
    Since you're using read, the write function would be more appropriate as a counterpart than print.

    I don't think that's right. The write function is for writing formatted records, from the documentation

    Writes a formatted record (possibly multi-line) to the specified FILEHANDLE, using the format associated with that file.

    There is no counterpart to read per se, just use print. Perhaps you were confusing write with syswrite which is the counterpart of sysread.

    Cheers,

    JohnGG