I've got some code that I've been trying to get to work but am failing pretty miserably at. I'm beginning to think it's just not possible to do this. Attached is a (possibly overly) simplified snippet of code

my @sciDbRows; my @hkDbRows; my @ancDbRows; my %dbFileArray = ( 'sci' => \@sciDbRows, 'hk' => \@hkDbRows, 'anc' => \@ancDbRows ); sub open1 { my $dbPath = '/home/user/SciPtrLoc.db'; use Fcntl 'O_RDWR', 'O_CREAT'; tie @sciDbRows, 'Tie::File', $dbPath, mode => O_RDWR | +O_CREAT or die; } sub write1 { my $part = 'sci'; my $ref = $dbFileArray{ 'sci' }; my @rows = @$ref; my $oneRec = "asdfg"; push(@rows, $oneRec); # does NOT work push(@{$dbFileArray{ $part }}, $oneRec); #does work $oneRec = "qwerty"; push(@sciDbRows, $oneRec); # does work } open1(); write1();

So I can push onto my tied file in some situations, but I'd like to get a better understanding what @{$dbFileArray{ $part }} actually is (an array? an array reference?) and also why I can't seem to assign it to a shorter and friendlier variable name, like @rows, so that later I can write

$rows[$index] = "new value";
instead of
@{$dbFileArray{ $part }}[$index] = "new value";

In reply to Looking for some insight on Tie::File by jweller1

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.