I think that you'd be better off using something like DBD::CSV or Text::CSV.

tie is intended to be used to tie a Perl variable (scalar, array, or hash) with a subroutine so that, to the user, it seems that they're using a regular Perl variable but every time they access that variable they are, in reality, invoking a subroutine call that handles the data in a form that is maybe totally different from normal Perl variables.

The reason that tie might be used with database modules is that it provides a simple, intuitive interface to the data. For example, the user can get a scalar variable tied to a DB field that, every time they read the value of that variable, the DB module looks up the field data for the next record in the DB. Or they could receive a tied hash that looks up field values by name instead of the user having to remember what order the fields are in and without the DB having to read an entire record into memory at once.

So, while you could build a tied variable interface to the files, you'll still have to build the routines to read that data in from the files. And for that, you'd probably want to go with one of the two CSV modules I mentioned above or, perhaps, one of the DBI modules...

Forgive me if I've rambled a bit and am not making any sense. It happens some times!  =) Let me know if that helps (or doesn't)!

bbfu


In reply to (bbfu)Re: Re: Re: Tie::RefHash by bbfu
in thread Tie::RefHash by malaga

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.