NAME

Tie::Array::FileWriter - A Perl module for writing records to files as items are pushed onto a virtual array

SYNOPSIS

use Tie::Array::FileWriter;
my @output;
tie @output, 'file.dat', ',', "\n"; # Write to file 'file.dat', use comma as field delimiter
push @output, [ qw(a b c d) ];
push @output, [ qw(e f g h) ];
untie @output;

DESCRIPTION

This is a write-only array that can only be written via push. It ignores anything pushed onto it that is not an array reference. Elements of array references are joined by the field delimiter and written to the output file, followed by the record delimiter.

You can write fixed-length records by ensuring the fields that are passed in are preformatted to thier desired fixed lengths and setting the field and record delimiters to empty strings.

The default field delimiter is the vertical bar ('|', also known as 'pipe'), and the default record delimiter is newline ("\n").

You can pass in either an already opened FileHandle object, or a file name. If you pass in a FileHandle object, the file will not be closed by Tie::Array::FileWriter.

AUTHOR

Gregor N. Purdy <gregor@focusresearch.com>

COPYRIGHT

Copyright (C) 2001 Gregor N. Purdy. All rights reserved.

LICENSE

This program is free software. It is subject to the same license as Perl itself.