in reply to File splitting script

It's possible for read to return fewer bytes than you actually asked for, especially if reading from a pipe, and almost certainly at the end of the file. This is one possibility; try seeing how many bytes were actually read, and subtracting that from $fsize instead. You should also check for errors in your read, print, and close calls; it's good practice, and it's possible one of those is failing causing the problem.

It should be straightforward to troubleshoot this by printing out the values of the various counters, and seeing where things go wrong.

Also, what OS are you on, and where did your Perl come from?