in reply to Re: split a file
in thread split a file

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^3: split a file
by GrandFather (Saint) on Dec 23, 2010 at 05:35 UTC
    Can you please modify it.

    I can, but I won't because you have made a trivial mistake that you can find easily yourself by examining the code and the output from the program and thinking a little. You should run the code in a console so that you see any errors, warnings or output generated when you run the script.

    I note too that you ignored my advice to use lexical file handles and the three parameter open so I've no confidence that you'll take notice of anything else I suggest. On the off chance that you are taking notice though, the increment of $num doesn't need to be conditional - the for loop has already done the counting for you. Making it conditional is misinformation - it looks like there could be ways of getting to that line when the increment shouldn't happen and that is not the case.

    True laziness is hard work
Re^3: split a file
by k_manimuthu (Monk) on Dec 23, 2010 at 05:33 UTC

    I think your almost completed. For the statement ' print $line;' show the record in the command line only. Insist of you print the file handler that affect the file.

    So change the below line in to your code.

    print OUT $line;