Hi Everyone, I have a quick(hopefully) question regarding a flat database. I'm trying to figure out how to "Skip" the first entry line in the DB...the first entry line being:
company_name|street|city_st_zip|phone|fax|website|email|category|alpha
Here's the code that I'm using:
$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; } }
Thanks for any help that you can give me guys! LisaW

In reply to Flat Database: Skip the first line by lisaw

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.