Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Use of Uninitialized in Concatenation or String Error?

by Laurent_R (Parson)
on Aug 09, 2013 at 12:56 UTC ( #1048766=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Use of Uninitialized in Concatenation or String Error?
in thread Use of Uninitialized in Concatenation or String Error?

Just to explain a bit more what the program does. In the first for loop, the program is opening 155 files, named from file0.txt to file154.txt (and writes a header line "File number #", this is not really needed, this was just a debugging mean of checking that the program does actually write correctly in all 155 files).

Then I read sequentially the input data file; for each line, I look for the locus and divide its value by 1000000 (integer division), which returns a range between 0 and 154. This range is then used to choose into which output file to print the current line.

Then there is a final for loop to close all the files.


Comment on Re^3: Use of Uninitialized in Concatenation or String Error?
Re^4: Use of Uninitialized in Concatenation or String Error?
by ccelt09 (Sexton) on Aug 09, 2013 at 14:55 UTC

    Awesome, that is quite efficient in the case that all files can be open and printed to at once, good thinking. The 1e6 range was the largest I'll be working with, the smallest being 1e3, meaning 155,247 files. For those I will have to get my original program to work, I don't know if opening that many files at once is feasible.

    I am working on getting a while loop to actually loop with a post incremented value, I think I'll try posing about it after a a few more attempts. Good on ya mate! Thanks for the help

      I do not think you will be able to open 155,247 files at the same time. But I don't think either that generating so many files will be practical and that they will be very usable. If you really want to do it, sorting the data first is probably the best solution.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2014-09-21 07:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (167 votes), past polls