Luba Pardo a écrit :
Dear list:
I wrote a script that takes a list of ids from an input file and store
these in an array in a pairwise-like manner (if total list is n then
the array is (2 ^n)-n). I need to extract for each pair of ids a
certain value from a huge file that contains the pair of ids and the
value (format of the file: col1 col2 id1 id2 value).
The script works but it is takes too long, specially because the
second file is too big (more than 600 MB).
I would like to increase the speed of the script, but I haven't quite
worked what is the best way to do it.
Any tip?
Thanks in advance,
L. Pardo
ps, I am attaching the script
When we want to read big files we should avoid the statement
'@name_array = <filehandle>' because it needs a lot of memory to store
all the lines in one array.
With big files the better way is 'while (<filehandle>) { ... }'
If you have only one big file you should begin your script with such a
bloc and inside this bloc put the others blocs 'for ...' or other bloc
'while (<fh2>) {}'.
If others files are big you should always avoid '@xxx = <fhy>' even if
you must open/close the same file several times but it depends on the
size of all files.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/