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.


In reply to Re^2: open a new xml file if line count exceeds 4000 lines by Anonymous Monk
in thread open a new xml file if line count exceeds 4000 lines by charan1717

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.