Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: simply appending to a scalar...

by bart (Canon)
on Jun 25, 2006 at 15:34 UTC ( #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? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2022-09-30 16:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (126 votes). Check out past polls.

    Notices?