On Mon, Jun 18, 2001 at 01:15:44PM -0500, Prabhu, Vrunda P (UMC-Student) wrote:
> I have an existing file, called mockalias that contains entries in the
> following format:
>
> username : e-mail address
> I want to use a hash %ALIAS to read the mockalias file into the hash
[snip]
> #!/usr/bin/perl
> use CGI ':standard';
> use DB_File;
The DB_File module reads and writes a specific, binary, format. It will
neither read nor write your "key : value" format.
There may be a module on CPAN for tying to a database of this format, or
tying to a database of any format, but after a brief look I didn't find
anything. My suggestion would be to either read the file into a hash and
then write it back out when done, or implement your own tied interface which
effectively does the same thing. You could also do a one-time conversion of
your format into the DB_File format.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--