Skip to content

Instantly share code, notes, and snippets.

Created October 12, 2012 05:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3877491 to your computer and use it in GitHub Desktop.
Save anonymous/3877491 to your computer and use it in GitHub Desktop.
readdb.pl
#!/usr/bin/env perl
use strict;
use warnings;
use DB_File;
use Fcntl;
my @arr;
my $recno = DB_File::RECNOINFO->new();
$recno->{flags} |= R_FIXEDLEN;
$recno->{reclen} = 100;
my $h = tie(@arr, 'DB_File', "test.db", O_CREAT|O_RDWR, 0600, $recno) or die "Can't tie file: $!";
print "length: " . $h->length . "\n";
undef $h;
untie @arr;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment