Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^3: Splitting a text file

by Ratazong (Prior)
on Mar 20, 2013 at 08:06 UTC ( #1024470=note: print w/ replies, xml ) Need Help??

in reply to Re^2: Splitting a text file
in thread Splitting a text file

Hi Dr Manhattan,

have a look at the difference between my algorithm and your solution: you open the file in each iteration of the loop. And by opening a file for writing, you erase the previous content.

The solution is to open the file before the loop. And (additionally) inside the if-block, when you want to switch to the next file.

HTH, Rata

Comment on Re^3: Splitting a text file
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1024470]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2015-12-02 07:40 GMT
Find Nodes?
    Voting Booth?

    My keyboard shows this many letters:

    Results (37 votes), past polls