How would I push a buffered string of 5 char's into an array that would break them into individual pieces? What I am trying to do is open a file, access the first of 5000 records which are each 5 bytes long and separated by a linefeed. Check to ensure values 2 and 4 are equal and 1 and 3 are not. Then output a count to an output file and then grab the next record and process the same till I get to the end of all records. This is what I have so far, but any help or ideas would be much appreciated. I have just begun using Perl, and am still getting into it and am not aware of all its components.
#!/usr/bin/perl -w
use strict;
undef $/;
open(INPUTFILE, "/u01/home/test_perl.dat"
;
or die "Couldn't open /u01/home/test_perl.dat for reading: $!\n";
open(OUTPUTFILE, ">//u01/home/countfile.dat"
;
while (read INPUTFILE, $buffer, 5) {
$string = $buffer; <-----THIS IS WHERE I AM CONFUSED
@array = split(//,$string);
foreach (@array){
Thanks in advance for you help.
Geek8
#!/usr/bin/perl -w
use strict;
undef $/;
open(INPUTFILE, "/u01/home/test_perl.dat"
or die "Couldn't open /u01/home/test_perl.dat for reading: $!\n";
open(OUTPUTFILE, ">//u01/home/countfile.dat"
while (read INPUTFILE, $buffer, 5) {
$string = $buffer; <-----THIS IS WHERE I AM CONFUSED
@array = split(//,$string);
foreach (@array){
Thanks in advance for you help.
Geek8