File: dbm2txt.pl

package info (click to toggle)
blootbot 1.1.0-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,420 kB
  • ctags: 586
  • sloc: perl: 15,941; sh: 154; makefile: 56; sql: 45
file content (24 lines) | stat: -rwxr-xr-x 438 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl -w

use strict;

if (!scalar @ARGV) {
    print "Usage: dbm2txt <whatever dbm>\n";
    print "Example: dbm2txt.pl factoids\n";
    exit 0;
}

my $dbfile = shift;
my %db;
if (0) {
    require "src/Factoids/db_dbm.pl";
    openDB();
}

dbmopen(%db,$dbname,0444) or die "error: cannot open db.\n";
foreach (keys %db) {
  next if /=>/;		# skip the key if it contains the delimiter.

  print "$_ => $db{$_}\n";
}
dbmclose %db;