David --- Senior Programmer Analyst --- Wgo Wagner wrote:
>
> You might look at sysopen, sysread which allows you to read in max
> blocks of data and process that data.
>
> It would look something like:
>
> sysopen(FILEIN,$filein,0) || die "unable to open file $filein: $!";
> bindmode(FILEIN);
$ perldoc -f bindmode
No documentation for perl function `bindmode' found
binmode(FILEIN);
> my $rcdbuf = "";
> my $rcdcnt = 0;
> my $rcdmax = 26;
> my $rcdcntrtn = 0;
> my @MyWorka = ();
> while ( 1 ) {
> sysseek(FILEIN,$rcdmax*$rcdcnt,0);
Using sysseek is redundant as sysread will set the file pointer to the
end of the chunk of data it just read.
> $rcdcntrtn = sysread(FILEIN,$rcdbuf,$rcdmax);
> if ( defined $rcdcntrtn ) {
sysread() could return less then the requested bytes so this may not do
what you want it to do (how do you know the buffer is full?)
> @MyWorka = unpack("a26",$rcdbuf);
You already (hopefully) have 26 bytes in $rcdbuf so why are you using
unpack? The 'a' format of unpack will read the data in $rcdbuf up to
the first "\0" (NULL) character (like a C string) so this may not do
what you want.
> $rcdcnt++;
> # could write your new file out here or do what you want.
> # if there can be less an x multiples, then you might need to
> check the length
> }else {
> last ;
> }
> } # end of while
>
> close(FILEIN);
>
> A different approach. ps If there can be linefeeds or carriage returns, then
> you will have to approach it different also.
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]