#!/usr/local/bin/perl -w use strict; use Fcntl; # For O_RDWR, O_CREAT, etc. use SDBM_File; use Storable qw/freeze thaw/; ... sub insert { my $table_name = shift; my $col_vals = shift; # ref to hash my %h; tie(%h, 'SDBM_File', $table_name, O_WRONLY , 0666) or die "Couldn't tie SDBM file $table_name: $!; aborting"; $h{$col_vals->{REQ}} = freeze $col_vals; untie %h; } sub select_all { my $table_name = shift; my %h; tie(%h, 'SDBM_File', $table_name, O_RDONLY , 0666) or die "Couldn't tie SDBM file $table_name: $!; aborting"; for my $i ( keys %h ) { my $row = thaw $h{$i}; print $i," -> "; while (my ($key,$val) = each %$row) { $val = 'undef' unless $val; print "\t", $key, ' = ', $val, "\n"; } } } ...