#!/usr/bin/perl -- use strict; use warnings; use File::Temp (); use DB_File; Main( @ARGV ); exit( 0 ); sub Main { my $temp = File::Temp->new()->filename; HitAndQuit( $temp, $_ ) for 1,2,3,4; HitAndQuit( $temp ) for 1 .. 1 + rand 12; unlink $temp or die "unlink $temp: $!"; } sub HitAndQuit { my $file = shift; my $recno = DB_File::RECNOINFO->new(); $recno->{flags} |= R_FIXEDLEN; $recno->{reclen} = 100; my $ofoo = tie my(@foo), 'DB_File', $file, O_RDWR|O_CREAT, 0600, $recno or die "Cannot tie ($file): $!"; @_ and push @foo, @_; print "length ", $ofoo->length, " scalar ", scalar @foo, "\n"; undef $ofoo; untie @foo; return; }