Dandello has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tie::File is driving me crazy
by wind (Priest) on Feb 01, 2011 at 18:37 UTC | |
by Dandello (Monk) on Feb 01, 2011 at 18:53 UTC | |
by ikegami (Patriarch) on Feb 01, 2011 at 18:59 UTC | |
|
Re: Tie::File is driving me crazy
by toolic (Bishop) on Feb 01, 2011 at 18:42 UTC | |
|
Re: Tie::File is driving me crazy
by ikegami (Patriarch) on Feb 01, 2011 at 19:04 UTC | |
by Dandello (Monk) on Feb 01, 2011 at 19:25 UTC |