Here's a test snippet for doing something like this without
the help of a module :

use strict;
use warnings;

my $file = 'training.txt';
my @matrix;
my @matrix2;

open OUT, ">$file" or die "create $file: $! ($^E)";
for (my $x = 0; $x < 26; ++$x) {
        for (my $y = 0; $y < 26; ++$y) {
                $matrix[$x][$y] = $x * 100 + $y;        # create the data first
                print OUT "$matrix[$x][$y] ";
        }
        print OUT "\n";
}
close OUT;

# now read it back into matrix2

open IN, $file or die "open $file: $! ($^E)";
my $ii = 0;
while (my $line = <IN>) {
        my @tmp = split ' ', $line;
        my $jj = 0;
        foreach (@tmp) {
                $matrix2[$ii][$jj] = 0 + $_;    # add 0 to unstringify if need 
be
                ++$jj;
        }
        ++$ii;
}
close IN;

# the two matrixes should now match

__END__

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to