#!/usr/bin/perl

use Fcntl 'O_RDWR', 'O_CREAT';
use SDBM_File;

tie %h, "SDBM_File", "/tmp/sdbm", O_RDWR|O_CREAT, 0666 or die; 
$pow2{1<<$_} = 1 for 0 .. 30;

my $N = shift;

for (1 .. $N) {
  my $key = sprintf "%09d", $_;
  $h{$key} = "-" x 991;
  if ($pow2{$_}) {
    my @stat = stat "/tmp/sdbm.pag";
    printf "%8d %12d %8d\n", $_, $stat[7], $stat[12];
  }
}

