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.