in reply to Re: open a new xml file if line count exceeds 4000 lines
in thread open a new xml file if line count exceeds 4000 lines

For now am unable to think logic on file spliting /writing into a new file once it exceeds sum count rather number of lines !Your help is greatly appreciated !

Its hard to devise new logic when the logic you already have is hard to determine.

It is easier to see the current logic once you cleanup the code. Then you can work on changing the logic because its easier to see what is missing.

If you want something new, here you go

while( $xfactor > 0 ){ my $newfile = sprintf 'new-x-%d-%d', $xfactor, $nimblefoot; MahFourThousand( $newfile, $xfactor, $nimblefoot ); $xfactor--; } sub MahFourThousand { my $counter = 0; while( $counter < 4000 ){ ## print one line $counter++; ## print 10 lines $counter += 10; ... } }

That is how I'd start changing your program, but I'm not 100% sure what you're after.

If you go ahead and make the changes we suggest, we'll help you make the next set of changes.