$database='entries.dat'; # Check to see if there was a database specified # if ($input{'database'} eq ''){ $db=$database; }else{ $db=$input{'database'}; } open (ORGDB,"<$database"); @ODB=; close (ORGDB); #This should sort the lines by company alpha-order @ODB = sort(@ODB); print "Content-type: text/html\n\n"; foreach $rec (@ODB){ chomp($rec); ($company_name,$street,$city_st_zip,$phone,$fax,$website,$email,$category,$alpha)=split(/\|/,$rec); print " Company $company_name
Street Address: $street
City, St., Zip: $city_st_zip
Phone: $phone
FAX: $fax
Website: $website
Email: $email
Category: $category
Alpha Listing: $alpha

\n"; } # Code to get the data from GET & POST # sub parse_form { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); if (length($buffer) < 5) { $buffer = $ENV{QUERY_STRING}; } @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $input{$name} = $value; } }