Article 24001 of comp.lang.perl:
Path: ig.co.uk!demon!news.sprintlink.net!pipex!uunet!haven.umd.edu!cs.umd.edu!mojo.eng.umd.edu!aria.eng.umd.edu!rensin
From: rensin@glue.umd.edu (David Rensin)
Newsgroups: comp.lang.perl
Subject: Re: Reading dBase .dbf files with perl
Date: 13 Nov 1994 23:12:34 GMT
Organization: Project GLUE, University of Maryland, College Park, MD
Lines: 68
Message-ID: <3a66h2$mcf@mojo.eng.umd.edu>
References: <3a0s58$aah@abyss.West.Sun.COM>
NNTP-Posting-Host: aria.eng.umd.edu
X-Newsreader: TIN [version 1.2 PL1]

Randy Gregor (rlg@random.West.Sun.COM) wrote:
: Does anyone know of perl routines to read .dbf files?

: Thanks,

: -- 
: Randy Gregor, SunSoft L.A.   rlg@West.Sun.COM    310-348-6037  (x46037)

The following is a shor perl prog I worte to read the structure of a .dbf.

Reading the records is simple after you know the structure.


		-dave :-)


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dave Rensin                        American Management Systems, Inc.
David_Rensin@mail.amsinc.com       Arlington, Va.

Regarding all oppinions expressed here:

	"There mine.. All mine, I tell you!! Wooh Hoo..."
			-Daffy Duck
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-------CUT HERE ------------

#! /usr/local/bin/perl


open (dbf,$ARGV[0]) || die "shit.";

binmode(dbf);

read(dbf,$foo,32);
read(dbf,$foo,32);

while ($foo =~ /^\w/ && $foo !~ /^. /) {

	$field_name = substr($foo,0,10);
	$field_type = substr($foo,11,1);
	$junk = substr($foo,12,1);
	$field_position = unpack("C",$junk);
	$junk = substr($foo,16,1);
	$field_length = unpack("C",$junk);

	write;	
	read(dbf,$foo,32);
}

print "\n";


format STDOUT_TOP =

Field Name            Field Type         Field Position       Field Length

.


format STDOUT =
@<<<<<<<<             @                  @<<<<<<<             @<<<<<
$field_name,$field_type,$field_position,$field_length
.

------- CUT HERE ------



