Re: Perl DB Question again

2001-06-21 Thread Michael Fowler
On Thu, Jun 21, 2001 at 08:48:08AM -0500, Prabhu, Vrunda P (UMC-Student) wrote: > I have the following code: [snip] > open Fin, "mockalias"; Always check your open calls: open Fin, "mockalias" or die("Unable to open file \"mockalias\": \l$!.\n"); [snip] > My question is the followi

Perl DB Question again

2001-06-21 Thread Prabhu, Vrunda P (UMC-Student)
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_H

Re: PERL DB Question

2001-06-19 Thread Vrunda Prabhu
PERFECT!! Works like magic. Thank you very much Victor. On Tue, 19 Jun 2001 [EMAIL PROTECTED] wrote: > > > > 1) unless you have previously populated the db file, it will start off > > > > as > > > > empty. > > > > > > > > I guess, this is my most basic and pressing question. A file by the name

Re: PERL DB Question

2001-06-19 Thread victor
> > > 1) unless you have previously populated the db file, it will start off > > > as > > > empty. > > > > > > I guess, this is my most basic and pressing question. A file by the name > > > mockalias exists which already has the usernames and e-mail addresses > > > separated by : > > > When I use

Re: PERL DB Question

2001-06-19 Thread Vrunda Prabhu
On Tue, 19 Jun 2001 [EMAIL PROTECTED] wrote: > > 1) unless you have previously populated the db file, it will start off > > as > > empty. > > > > I guess, this is my most basic and pressing question. A file by the name > > mockalias exists which already has the usernames and e-mail addresses >

Re: PERL DB Question

2001-06-18 Thread Michael Fowler
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/per

Re: PERL DB Question

2001-06-18 Thread victor
> 1) unless you have previously populated the db file, it will start off > as > empty. > > I guess, this is my most basic and pressing question. A file by the name > mockalias exists which already has the usernames and e-mail addresses > separated by : > When I use the tie command, am I not pulli

RE: Perl DB Question

2001-06-18 Thread Stephen Neu
: and may I suggest a little loop like this : : :foreach (keys %hash) :{ : print "$_ :: $hash{$_}\n"; :} : : which will print the content of the hash in a nice looking fashion. : I have found Data::Dumper to be excellent in printing lol's and references in a pretty fashion. use Data::Dumper;

RE: PERL DB Question

2001-06-18 Thread Prabhu, Vrunda P (UMC-Student)
$DB_HASH; > $key = "vrunda"; > if (exists $ALIAS{$key}) > { > print "$key has value $ALIAS{$key}\n"; > } > print "$ALIAS"; > untie %ALIAS; > > -----Original Message- > From: [EMAIL PROTECTED] > To: Prabhu, Vrunda P (UMC-Student) &

Re: PERL DB Question

2001-06-18 Thread victor
; $key = "vrunda"; > if (exists $ALIAS{$key}) > { > print "$key has value $ALIAS{$key}\n"; > } > print "$ALIAS"; > untie %ALIAS; > > -----Original Message- > From: [EMAIL PROTECTED] > To: Prabhu, Vrunda P (UMC-Student) > Cc: &#

RE: PERL DB Question

2001-06-18 Thread Prabhu, Vrunda P (UMC-Student)
Message- From: [EMAIL PROTECTED] To: Prabhu, Vrunda P (UMC-Student) Cc: '[EMAIL PROTECTED]' Sent: 6/18/01 1:29 PM Subject: Re: PERL DB Question Try this instead tie %ALIAS, "DB_File", "$filename", O_RDWR|O_CREAT, 0644, $DB_HASH; "Prabhu, Vrunda P (UMC-Stud

Re: PERL DB Question

2001-06-18 Thread victor
Try this instead tie %ALIAS, "DB_File", "$filename", O_RDWR|O_CREAT, 0644, $DB_HASH; "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 mock

PERL DB Question

2001-06-18 Thread Prabhu, Vrunda P (UMC-Student)
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, and then be able to delete, update, add entries to this hash. When I run the following code, it tells me that t