#!/usr/bin/perl use DB_File; my $file = shift || die "usage: $0 file"; %hash = (); tie %hash, 'DB_File', $file, O_RDONLY, 0666, DB_HASH or die "can't read file '$file': $!"; print "$file has ", scalar(keys %hash), " entries\n"; print map { " $_ => $hash{$_}\n" } sort keys %hash;