#!/usr/bin/perl use strict; use DB_File; my %Index; tie (%Index,'DB_File',"/home/maverick/tmp/index_dbm",O_RDWR,0640,$DB_BTREE) || die "Tie Failed: $!"; print ">"; while(<>) { # chop off the newline $_ =~ s/[\r\n]//go; if (defined($Index{$_})) { print "$_ found in:\n"; # replace all the ~ with \n (without modifying the index) print join("\n",split(/~/,$Index{$_})),"\n"; } else { print "Not Found\n"; } print ">"; } untie(%Index);