Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Best way to edit a file?

by MaxKlokan (Monk)
on Apr 02, 2007 at 08:50 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://607781]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-18 10:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found