You can use the DBM hash. Using DBM hash the data will get stored in a database file, and at the same time it is as easy as working with hashes.
Here, is a sample code to work with DBM hashes,
in reply to Caching or using values across multiple programs
my %hash; # To open a dbmfile and associate with hash
dbmopen(%hash, "nagalenoj", '0666') || die "Can't open database file!"