home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / perl / 5940 < prev    next >
Encoding:
Text File  |  1992-09-15  |  2.5 KB  |  72 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!mcsun!Germany.EU.net!nixpbe!news.sni.de!neurotic!kebsch
  3. From: kebsch@neurotic.sni.de (Waldemar Kebsch)
  4. Subject: dbm problems/questions (msdos-perl).
  5. Message-ID: <kebsch.716557576@neurotic>
  6. Sender: news@nixpbe.sni.de
  7. Organization: Siemens Nixdorf Info.Sys. AG, Paderborn, Germany
  8. Date: Tue, 15 Sep 1992 11:46:16 GMT
  9. Lines: 61
  10.  
  11. Hi,
  12.  
  13. I have fetched PERL419X.ZIP from Simtel and it runs fine. Because I have
  14. no experience with dbm I wrote a simple example using dbmopen(), dbmclose(),
  15. etc.. It works fine, but the [????????.dir] file is only 0 bytes long???
  16.  
  17. Here some piece of information ..
  18. ---------------------------------------------------------------------------
  19. The PERL script, I wrote ...
  20. ---------------------------------------------------------------------------
  21.     # Simple dbm test (W. Kebsch)
  22.  
  23.     dbmopen(db, 'database', 0666);
  24.  
  25.     $db{'a'} = 'Data(a)';
  26.     $db{'b'} = 'Data(b)';
  27.     $db{'c'} = 'Data(c)';
  28.  
  29.     dbmclose(db);
  30.  
  31.     dbmopen(db, 'database', 0666);
  32.  
  33.     @keys = keys(%db);
  34.     @values = values(%db);
  35.     printf("keys=%d, values=%d\n", $#keys + 1, $#values + 1);
  36.  
  37.     while(($key, $value) = each(db)) {
  38.     printf("key=%s, value=%s\n", $key, $value);
  39.     }
  40.  
  41.     dbmclose(db);
  42. ---------------------------------------------------------------------------
  43. The directory before running the script ...
  44. ---------------------------------------------------------------------------
  45. PERL286  EXE   324619  23.02.92  11.20
  46. TDBM     PL       399  15.09.92  13.29
  47. ---------------------------------------------------------------------------
  48. The output of the command: "C>PERL286 TDBM.PL"
  49. ---------------------------------------------------------------------------
  50. keys=3, values=3
  51. key=b, value=Data(b)
  52. key=a, value=Data(a)
  53. key=c, value=Data(c)
  54. ---------------------------------------------------------------------------
  55. The directory after running the script ...
  56. ---------------------------------------------------------------------------
  57. PERL286  EXE   324619  23.02.92  11.20
  58. TDBM     PL       403  15.09.92  13.29
  59. DATABASE PAG     1560  15.09.92  13.32
  60. DATABASE DIR        0  15.09.92  13.32
  61. ---------------------------------------------------------------------------
  62.  
  63. Hmm .., what's going wrong (what I am doing wrong?) ?
  64.  
  65. Thanks in advance for your help!
  66. Waldemar
  67. --
  68. Waldemar Kebsch, c/o  SIEMENS NIXDORF Informationssysteme AG, STO SI 32,
  69.                W-4790 Paderborn, Federal Republik of Germany
  70. Email (USA)  : kebsch.pad@sni-usa.com        |  Phone: (+49) 5251 835645
  71. Email (World): kebsch.pad@sni.de             |  Fax  : (+49) 5251 835602
  72.