#!/usr/bin/perl -wT use strict; use DB_File; my $dbmfile = '/tmp/lookuptable'; tie my %lookuptable, "DB_File", $dbmfile, O_RDWR|O_CREAT, 0640, $DB_HASH or die "Cannot open file '$dbmfile': $!\n"; # do whatever it is to get the ids... my $id = '123456789'; # check lookup cache: my $cachevalue = $lookuptable{$id}; if ($cachevalue eq 'Y') { # link is ok } elsif ($cachevalue eq 'N') { # link is bad } else { # determine if it is good or bad. my $isok = 'Y'; # add the calculated value to the cache $lookuptable{$id} = $isok }