http://qs1969.pair.com?node_id=557440


in reply to simply appending to a scalar...

For what its worth, I plan to implement some code that will be handling rather large amounts of data, but the data is likely to arrive in aprox 8kb chunks from a filehandle with a sysread call.
In that case, let sysread do the work for you.
sysread FILEHANDLE,SCALAR,LENGTH,OFFSET

An OFFSET may be specified to place the read data at some place in the string other than the beginning.

Test script:
$_ = "Old buffer "; sysread DATA, $_, 4, length; print; __DATA__ datadatadata
Result:
Old buffer data
So this effectively can be used to append.