Victor had graciously answered some of my questions earlier about using
DB_File in a perl CGI. I am now wondering about the following:
I have the following code:
******************************
$filename="./mockalias.db";
tie %ALIAS, 'DB_File', "$filename", O_RDWR|O_CREAT, 0644, $DB_HASH;
my ($key, $values);
open Fin, "mockalias";
while (<Fin>)
{
($key, $value) = split(/:/, $_);
$ALIAS{$key} = $value;
}
close Fin;
###########################
#### If Continue is selected, new entry will be created in the
#### Alias file
###########################
if ($recstatus eq "Continue")
{
$ALIAS{$login} = $loginaddress;
### If update is selected
if ($recstatus eq "Update")
{
$ALIAS{$login} = $loginaddress;
###HTML code...
}
### If delete is selected
if ($recstatus eq "Delete")
{
delete $ALIAS{$firstname};
delete $ALIAS{$login};
##HTML code...
}
untie %ALIAS;
*************************************
My question is the following: When one gives the update, delete commands,
is the file mockalias also accordingly updated? (MY file seems to not have
any changes). Once, the hash ALIAS is "untied", should one then rewrite to
the file from the hash?
Thanks in advance. ( I am a student, as you can tell from my address above,
however, none of this is my homework. I am doing an internship and have
been assigned two projects, but no one here is there to help me, so I truly
appreciate all your help).
Thanks again.
Vrunda