Next Lightweight Databases 57

Tie::File Examples

What Else?

        tie @FILE, 'Tie::File', $file or die ...;
        push @FILE, $new_last_record;
        my $old_last_record = pop @FILE;
        my $old_first_record = shift @FILE;
        # Truncate or extend the file
        $#FILE = 100;
        # How long is the file?
        $n_lines = @FILE;
        # Overwrite the file
        @FILE = qw(I like pie);


Next Copyright © 2003 M. J. Dominus