You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
581 B
Perl

#!/usr/bin/perl -w
# Usage:
# Perl readDB.pl database
use SDBM_File;
use Fcntl;
# Print format for STDOUT.
format STDOUT=
@<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$key, $value
.
$database = $ARGV[0];
$mode = 0666;
$flags = O_RDONLY | binary();
tie(%execs, 'SDBM_File', $database, $flags, $mode) or die "Can't open \"$database\" due to $!";
while ( ($key,$value) = each(%execs) ) {
write;
}
untie(%execs);
sub binary() {
return O_BINARY if is_windows();
}
sub is_windows() {
return $^O =~ /^(MS)?Win/;
}