Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Slow file creator

by guha (Priest)
on Feb 07, 2004 at 23:45 UTC ( [id://327396]=note: print w/replies, xml ) Need Help??


in reply to Slow file creator

It's not clear if you don't care about the file's content as long it has the right size, if so the code below will be quite quick.

my $req_len = shift || 100; open FH, "+>", 'test.txt'; seek FH, $req_len - 1,0; print FH 'X'; close FH;

or simpler ?

my $req_len = shift || 100; truncate 'test.txt', $req_len;
HTH

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-23 22:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found