Hi folks,

I'm working on a script in which I want to access NDBM files directly.
I'm using the unix aliases file(s) for testing, but I intend to use this
code for other projects as well.

I have the following files: aliases, aliases.dir, and aliases.pag.
According to the man page for aliases, these are "ndbm files maintained
by newaliases".

I want to write something to query/update the database files (the .dir
and .pag files?) directly, but I need a push in the right direction.

What I've done so far is just modify the code in the perldoc for
NDBM_File as a test, but it doesn't work. I am at a loss for how to
begin. Any suggestions would be appreciated.

Thanks.

Here's my

<CODE>
#!/usr/bin/perl
use warnings;
use strict;
use NDBM_File;
use Fcntl;


my %ALIAS;

tie(%ALIAS, 'NDBM_File', './aliases', O_RDWR|O_CREAT, 0644) or
   die "Couldn't tie NDBM file : $!; aborting";

print "My alias = ", $ALIAS{rfernandez}, "\n";

untie %ALIAS;

</CODE>

This produces this output:
Use of uninitialized value in print at ./mytest1.pl line 13.
My alias = 

and creates a file called aliases.db

Thanks!

richf

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to