#!/usr/bin/perl use strict; use warnings; use DB_File; unlink 'db'; # to prevent dupes if this is run more than once tie my %hash, 'DB_File', 'db', O_CREAT|O_RDWR, 0644, $DB_BTREE; print "Building \%hash...\n"; $|++; for my $count (1 .. 50) { my @time = localtime; my $key = $time[5] + 1900; $key .= sprintf "%02d", $time[$_] for reverse 0 .. 4; print "$count... " if $count % 10 == 0; $hash{$key} = "Message number $count"; sleep 1; } print "Output:\n"; print "$_: $hash{$_}\n" for keys %hash;