use Data::Dumper;
$datafile = 'testdata.txt';
chomp $datafile;
open (INPUT, $datafile) || die ("Unable to open $datafile");
@data = ;
close INPUT;
@dim = split(/\,/, $data[0]);
$width = $dim[0];
$height = $dim[1];
@table = @data[1..$height];
print Dumper(@table); die;
for($row = 0; $row < $height; $row++) {
for($col = 0; $col < $width; $col++) {
$myString = $myString.$table[$row][$col];
}
$myString ="";
}
####
use strict;
use warnings;
my $datafile = $ARGV[0] || die "File to open was not provided!";
my @data;
open (DATA_FILE, '<', $datafile) || die ("Unable to open $datafile");
@data = ;
close(DATA_FILE);
my @dim = split /\,/, $data[0];
my $width = $dim[0];
my $height = $dim[1];
my @table;
push (@table, @data[1..$height]);
my $myString ='';
for(my $row = 0; $row < $height; $row++) {
for(my $col = 0; $col < $width; $col++) {
$myString .= substr($table[$row], $col, 1);
}
$myString ="";
}