Hi Michael, the problem is not with the "undef" value - undef is fine - if you read the dbmopen's documentation you could see it.
If I choose a value like "0644" the script still doesn't work. Bellow, is the output of the execution of the same program, but with 0644 in place of undef: Uncaught exception from user code: No aliases!: Invalid argument at ./zz line 3. I must admit that the errors are shorter but the program still doesn't work!! Oh, hell!!! Thank you for any help, bnegrao. ----- Original Message ----- From: "Michael Kelly" <[EMAIL PROTECTED]> To: "Perl Beginners List" <[EMAIL PROTECTED]> Sent: Friday, September 27, 2002 1:04 AM Subject: Re: dbmopen can't open /etc/aliases.db file > On Thu, Sep 26, 2002 at 09:38:18PM -0300, Bruno Negrao - Perl List wrote: > > Hi, > > Hi Bruno, > > > I'm triyng to open the /etc/aliases.db file for reading with the dbmopen > > function - the result is that I can't open the file for reading, or > > something like this. yes, I have permission because I'm root. > > > > My script is: > > #!/usr/bin/perl -w > > use diagnostics; > > dbmopen(%ALIAS,'/etc/aliases',undef) || > > die "No aliases!: $!"; > > while (($key,$value) = each(%ALIAS)) { > > chop($key,$value); > > print "$key $value\n"; > > } > > Disclaimer: I've never messed around with dbmopen() before, so I can't test this > example, but seeing as nobody with more authority has answered this yet, I'll > give it a shot: > > dbmopen() expects a file permission mask (an octal number) as its third argument, > which 'undef' is not. You might try something like this as your lines 3 and 4: > > dbmopen(%ALIAS,'/etc/aliases', 0644) || > die "No aliases!: $!"; > > Even if you're sure /etc/aliases is there, that should make dbmopen() happy. > > Again, not sure if that's the answer, but it seems logical to me, > -- > Michael > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]