Dear PerlMonks, Here's what I'm trying to accomplish: I have a perl script that accesses a flat file db that simply lists a company name($company), company url($url), and company directory($directory). I want to be able to open a second flat file db that contains the company name and a subdirectory link and list it below the matching company. Like this:
Company 1
   -Company 1 sub link 1
   -Company 1 sub link 2
Company 2
   -Company 2 sub link 1
Here's my code:
{ &directories; } sub directories { $database="company_file.dat"; open(FILE, $database) || die "can't open"; @list = <FILE>; close(FILE); $numlist = @list; print "Content-type: text/html\n\n"; print <<"EOF"; Company Listings: EOF for ($a = 0; $a < $numlist; $a ++) { ($company, $url, $directory) = split(/\|/, $list[$a]); print "$company, $url, $directory<BR>\n"; } close(FILE); } 1;
My subdirectory flat file db contains:
$company, $sub-url, $sub-directory, $sub-maindir
Any suggestions...or links to existing examples would be greatly appreciated... lis

In reply to Flat File Question 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.