Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: help with SEEK

by takshaka (Friar)
on Jun 29, 2000 at 10:33 UTC ( [id://20333]=note: print w/replies, xml ) Need Help??


in reply to help with SEEK, TELL, READ, others

In addition, if I simply want to read the entire file into the scalar using read(), how would I do that, since I don't know the length (in bytes) to ask for?
my $buf; $scalar .= $buf while read(FH, $buf, 4096);
or
my $size = (stat FH)[7]; read(FH, $scalar, $size);
As long as all processes honor your flock, there shouldn't be a race condition with the stat + read, but it still makes me uncomfortable.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://20333]
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-25 15:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found