Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: simply appending to a scalar...

by bart (Canon)
on Jun 25, 2006 at 15:34 UTC ( [id://557440]=note: print w/replies, xml ) Need Help??


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.

Replies are listed 'Best First'.
Re^2: simply appending to a scalar...
by abachus (Monk) on Jun 25, 2006 at 18:10 UTC
    bingo, i'm very gratefull for the answers i've received,
    indeed sysread() can do all that i need and i overlooked that.
    thank you :)

    Isaac.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://557440]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-19 20:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found