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";