lisaw has asked for the wisdom of the Perl Monks concerning the following question:
Here's the code that I'm using:company_name|street|city_st_zip|phone|fax|website|email|category|alpha
Thanks for any help that you can give me guys! LisaW$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=<ORGDB>; 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,$c +ategory,$alpha)=split(/\|/,$rec); print "<tr><td valign=top width=90><font size='2'><a href='business_ad +min_edit2.cgi?company_name=$company_name&street=$street&city_st_zip=$ +city_st_zip&phone=$phone&fax=$fax&website=$website&email=$email&categ +ory=$category&alpha=$alpha'><img src='gfx/button_edit.gif' border=0>< +/a> </font></td> <td valign=top><font size='2'><B>Company</B> $company_na +me<BR> <B>Street Address:</B> $street<BR> <B>City, St., Zip:</B> $cit +y_st_zip<BR> <B>Phone:</B> $phone<BR> <B>FAX:</B> $fax<BR> <B>Website +:</B> $website<BR> <B>Email:</B> $email<BR> <B>Category:</B> $categor +y<BR> <B>Alpha Listing:</B> $alpha<BR><BR></td></tr>\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; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Flat Database: Skip the first line
by grep (Monsignor) on Jan 26, 2002 at 00:21 UTC | |
|
Re: Flat Database: Skip the first line
by impossiblerobot (Deacon) on Jan 26, 2002 at 01:29 UTC | |
|
Re: Flat Database: Skip the first line
by petral (Curate) on Jan 26, 2002 at 04:38 UTC | |
|
Re: Flat Database: Skip the first line
by Ineffectual (Scribe) on Jan 26, 2002 at 01:14 UTC | |
|
Re: Flat Database: Skip the first line
by vek (Prior) on Jan 26, 2002 at 00:44 UTC |