Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Fastest way of changing the beginning of a txt file..

by pwagyi (Scribe)
on Feb 19, 2019 at 03:21 UTC ( #1230131=note: print w/replies, xml ) Need Help??


in reply to Fastest way of changing the beginning of a txt file..

You can try Tie::File (https://perldoc.perl.org/Tie/File.html)

The file is not loaded into memory, so this will work even for giganti +c files. Changes to the array are reflected in the file immediately.

Replies are listed 'Best First'.
Re^2: Fastest way of changing the beginning of a txt file..
by haukex (Chancellor) on Feb 19, 2019 at 18:15 UTC
    You can try Tie::File

    Unfortunately, Tie::File adds significant overhead, so it's pretty safe to assume that it would slow things down and burn more memory.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2019-06-20 03:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (89 votes). Check out past polls.

    Notices?