Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^4: How to tokenize a RTF file and print it to another file (Update with solution)

by Laurent_R (Canon)
on Jul 07, 2017 at 17:03 UTC ( [id://1194520]=note: print w/replies, xml ) Need Help??


in reply to Re^3: How to tokenize a RTF file and print it to another file (Update with solution)
in thread How to tokenize a RTF file and print it to another file

Hi thanos1983,

why not load the data into an array and access the array when ever you want instead of keeping the fh open
There can be many reasons for not doing that. The most compelling one, which I face almost daily, is that my files often have hundreds of millions of lines. They simply do not fit in memory. And the files I am writing to usually have similar size.

Even with smaller but still quite large files, it is usually faster to read the file line by line and process each line, rather than copying the data into an array, process each item of the array and then write back the modified array lines

  • Comment on Re^4: How to tokenize a RTF file and print it to another file (Update with solution)

Replies are listed 'Best First'.
Re^5: How to tokenize a RTF file and print it to another file (Update with solution)
by thanos1983 (Parson) on Jul 07, 2017 at 21:45 UTC

    Hello Laurent_R,

    Well I have read about this again, just never had the case to work such huge files. In these cases I guess you are right.

    Thanks for pointing out. BR

    Seeking for Perl wisdom...on the process of learning...not there...yet!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-19 23:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found