mantager has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks,
I'm really seeking for your wisdom, since I can't get up with an aswer from the net to this question: how do I concatenate two buffers I got from a couple of sysread()?
Here is my pseudocode:
my $bufsize = 256 * 1024; sysopen my $in1, 'somefile', O_RDONLY; sysopen my $in2, 'someother', O_RDONLY; sysopen my $out, 'outputfile', O_WRONLY|O_CREAT|O_TRUNC; binmode($in1); # Is this necessary? binmode($in2); binmode($out); while (sysread($in1, my $buf1, $bufsize) && sysread($in2, my $buf2, $bufsize)) { my $data = <CONCAT $buf1 & $buf2>; # HOW? syswrite $out, $data, 2 * $bufsize; }
Anyone can help me, please?
Thanks in advance.
|
---|
Back to
Seekers of Perl Wisdom