Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: How do I write to a file?

by devslashneil (Friar)
on Jun 22, 2003 at 04:41 UTC ( #267915=note: print w/replies, xml ) Need Help??


in reply to How do I write to a file?

The Tie::File module can be used to bind an array to a file.

Any changes you make to the array are then made retrospectivly to the file, without having to load the file into memory.

This is especially useful for large files
ex.
#!/usr/bin/perl use strict; use Tie::File; my @array; my $filename = 'foo.dat'; tie @array, 'Tie::File', $filename or die "Error: Cannot open $filenam +e\n"; push @array, "Hello, World!\n";

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2021-05-16 12:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (151 votes). Check out past polls.

    Notices?