I have a script that will read from a Tied file without problems.

But I'm missing something painfully obvious when trying to write to a tied file.

#!/usr/bin/perl ###################################################################### +############ use strict; #use warnings; use Tie::File; popfileb(); print qq{DONE!!\n} or die 'unable to print to screen'; my @aod=(); my @aox=(); tie @aod, 'Tie::File', 'tmp/test.txt', recsep => "\n"; sub popfileb { foreach my $yb ( 0 .. 10 ) { foreach my $xb ( 0 .. 10 ) { #set first row; if ( $yb == 0 ) { substr $aox[0], $xb, 1, 'n'; } #set increasing rows; elsif ( $yb > 0 ) { substr $aox[$yb], $xb, 1, 'a'; } } $aod[$yb] = qq{$aox[$yb]\n}; } return; } untie @aod; exit;

The script runs but doesn't output anything to the file.

I've gone through all the examples I can find but can't seem to get a handle on this.


In reply to Tie::File is driving me crazy by Dandello

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.