Loading ...
Sorry, an error occurred while loading the content.
 

Retrieve value from SDBM_File

Expand Messages
  • harrishouk
    New to Perl and new to this board. Set up a SDMB_File named accounts: I know this is primitive - but just getting started. #open database, add record, close
    Message 1 of 1 , May 31 4:01 AM
      New to Perl and new to this board. Set up a SDMB_File named accounts:
      I know this is primitive - but just getting started.

      #open database, add record, close database
      tie(%list, "SDBM_File", "accounts", O_CREAT|O_RDWR, 0666)
      or die "Error opening accounts. $!, stopped";
      $password =~ tr/a-z/p-za-o/;
      $list{$acct} = $password;
      untie(%list);

      Now I need to retrieve the password and print it unencrypted. This
      doesn't work:

      #open database
      tie(%list, "SDBM_File", "accounts", O_RDWR, 0)
      or die "Error opening accounts. $!, stopped";

      #get password from database
      if (exists($list{$acct})){
      $msg = "Your Books Online password is";
      $msg = $msg . $password;
      }
      The else statement works - so that's ok!

      Any help would be appreciated.

      Thank you
      LuLu
    Your message has been successfully submitted and would be delivered to recipients shortly.