frech@mwraaa.army.mil (Norman R. Frech CPLS) (12/19/90)
This script is doing what I want, but it is fairly slow. Any suggestions
for getting some more speed out of it???
*** cut here ***
eval "exec /usr/local/bin/perl -S $0 $*"
if $running_under_some_shell;
# this emulates #! processing on NIH machines.
# (remove #! line above if indigestible)
for (@ARGV) {
y/a-z/A-Z/;
}
$temp = join($",@ARGV);
print "\nSearching database for @ARGV\n\n";
$recfmt = "a5 A15 a2 x1";
$reclen = length(pack($recfmt,()));
open(Z, "zipcodes.dbf") || die;
seek(Z,130,0);
line: while(read(Z,$rec,$reclen)) {
($zip,$city,$state) = unpack($recfmt,$rec);
$templ = join($",$city,$state);
last line if $templ =~ /$temp/ ;
}
close(Z);
print "$zip $city $state\n";
# Norm Frech < frech@mwraa.army.mil >