fionbarr has asked for the wisdom of the Perl Monks concerning the following question:

This may be a silly question: I want to store data that looks like:
$hash{key} = "|1,2,3|mail1 address|mail2 address"
What happens if I want to add another address to an existing record such that:
$hash{key} = "|1,2,3|mail1 address|mail2 address|page1 address"
Do I have to read/rewrite the entire file?

Replies are listed 'Best First'.
Re: DB_FILE tied hash
by jethro (Monsignor) on May 26, 2010 at 14:44 UTC
    No, DB_FILE (or to be more specific the BerkeleyDB database engine) handles storage in a way that searching for and rewriting of data items are not expensive operations. That is one of the reasons complex database engines are used instead of simply storing data sequentially on disk
      just what I wanted to know...thanks.