S
SL_McManus
Hi;
What I am trying to do is to read the input file and and pull a
10 byte section of lines 4 - 6 to a variable. I would take these in
order and drop the numbers into $x, $y, & $z. I'm not sure if I have
something mislabled or my logic is incorrect. I commented out two
sections to try to isolate one variable. Any thoughts are welcomed.
Input File (6 lines long)
Initial Check file for auditing
Initial Input File TC 849
Greater than 9.99 File TC 847
Less than/equal to 9.99 File TC 2
$linecount = 6;
$lineread=0;
$value=1;
$count=0;
# start output
my @lines = ( );
open(AUDTFILE, '>'.$audtfile) || die "Unable to open $audtfile $!\n";
binmode(AUDTFILE);
for $line (@lines) {
# split it up per-line
for $linecount (split(/\r?\n/, $line)) {
# this is the line we care about
if ($linecount == 4) {
# substr($line, [col to start], [number of char's to go])
my $x = substr($line, 37, 10);
}
#else ($linecount == 5) {
# my $y = substr($line, 37, 10);
# }
#else ($linecount == 6) {
# my $z = substr($line, 37, 10);
# }
}
}
close(AUDTFILE);
What I am trying to do is to read the input file and and pull a
10 byte section of lines 4 - 6 to a variable. I would take these in
order and drop the numbers into $x, $y, & $z. I'm not sure if I have
something mislabled or my logic is incorrect. I commented out two
sections to try to isolate one variable. Any thoughts are welcomed.
Input File (6 lines long)
Initial Check file for auditing
Initial Input File TC 849
Greater than 9.99 File TC 847
Less than/equal to 9.99 File TC 2
$linecount = 6;
$lineread=0;
$value=1;
$count=0;
# start output
my @lines = ( );
open(AUDTFILE, '>'.$audtfile) || die "Unable to open $audtfile $!\n";
binmode(AUDTFILE);
for $line (@lines) {
# split it up per-line
for $linecount (split(/\r?\n/, $line)) {
# this is the line we care about
if ($linecount == 4) {
# substr($line, [col to start], [number of char's to go])
my $x = substr($line, 37, 10);
}
#else ($linecount == 5) {
# my $y = substr($line, 37, 10);
# }
#else ($linecount == 6) {
# my $z = substr($line, 37, 10);
# }
}
}
close(AUDTFILE);