Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Best way to edit a file?

by MaxKlokan (Monk)
on Apr 02, 2007 at 08:50 UTC ( #607781=note: print w/replies, xml ) Need Help??


in reply to Best way to edit a file?

Tie::File might help here. From the docs:
Tie::File represents a regular text file as a Perl array.
Each element in the array corresponds to a record in the
file. The first line of the file is element 0 of the 
array; the second line is element 1, and so on.

The file is not loaded into memory, so this will work even for gigantic files.

Changes to the array are reflected in the file immediately.
Cheers,

Max

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2020-10-29 06:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (269 votes). Check out past polls.

    Notices?