]> git.donarmstrong.com Git - infobot.git/blob - scripts/dbm2txt.pl
Initial revision
[infobot.git] / scripts / dbm2txt.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 if (!scalar @ARGV) {
6     print "Usage: dbm2txt <whatever dbm>\n";
7     print "Example: dbm2txt.pl factoids\n";
8     exit 0;
9 }
10
11 my $dbfile = shift;
12 my %db;
13 if (0) {
14     require "src/Factoids/db_dbm.pl";
15     openDB();
16 }
17
18 dbmopen(%db,$dbname,0444) or die "error: cannot open db.\n";
19 foreach (keys %db) {
20   next if /=>/;         # skip the key if it contains the delimiter.
21
22   print "$_ => $db{$_}\n";
23 }
24 dbmclose %db;