Hi guys..

I'm stuck with a flat file | seperated fields database which is huge actually. and I want to generate HTML files based on the subcategory, and stuff all the other information for each subcategory in the specific file..

So my bet was to read the file line by line and create subcategory-named-files whenever a new subcategory is encountered, because the subcategories aren't sorted.

anyway, can I create filehandles that evaluate from a variable? and if I can, I might end up with about 50 filehandles opened at the end of the operation which I have to close, can I close every opened filehandle? or do I have to specify a close() for each one?

Here's an example of the data file, I trimmed down the info and messed it up.

ID|Category|SubCategory|Code|Description|Picture ex: 0|OFFICE EQUIPPMENT|PEN|PDS01|an ordinary pen|pen.gif 1|OFFICE EQUIPPMENT|PEN|PDS02|another pen|pen2.gif 2|OFFICE EQUIPPMENT|PAPER|PA003|white sheets to write on|paper.gif 3|OFFICE EQUIPPMENT|PEN|PDD50|the greatest pen|pen50.gif 4|OFFICE EQUIPPMENT|PEN|PDS01|an ordinary pen|pen.gif

He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

Chady | http://chady.net/

In reply to About Filehandles by Chady

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.