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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|