in reply to Re: what is the purpose of Tie::File
in thread what is the purpose of Tie::File

Having a glitch of some kind---code is coming:). Here:

How delightfully refreshing, here's mine

P.S.

It now runs great!

#!/usr/bin/perl -l -- # really ensures warnings BEGIN { $^W = 1; } BEGIN { ${^WARNING_BITS} = 0; } BEGIN { $^H |= 0x00000002 |0x00000200 |0x00000400; } BEGIN { $/ = "\n"; $\ = "\n"; } BEGIN { BEGIN { use Carp::Always; use Carp qw/ confess /; sub unlink { my $goners ; while(@_){ my $file = shift; unlink $file or confess "Can't unlink('$file'): $!"; $goners++; } return $goners; } } } local $SIG{__DIE__} = sub { confess "Uncaught exception: @_" unless $^S; }; use strict; use warnings; use autodie; use Tie::File; my $file = "file.txt"; 1 while unlink $file; my $o = tie my @lines, 'Tie::Tile', $file, memory => 0; for (@lines) { $lines[42] = "something else is here now"; print $lines[42]; #line 42 is now "something else is here now". } END { END { END{ END { undef $o; untie @lines; 1 while unlink $file; #really clears and empties everything. } } } } __END__

The output is twice as much