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

Re: limit output filesize

by QM (Parson)
on Jul 08, 2005 at 18:58 UTC ( [id://473541]=note: print w/replies, xml ) Need Help??


in reply to limit output filesize

Something like this?
my $output_file = 'output_0000'; my $file_size = 0; open(STDOUT,>,$output_file) or die "Error opening $output_file for writing, "; while (my $line = <>) { do_something($line); if ($file_size > 50000) { close STDOUT or die "Error closing $output_file, "; $output_file++; # magic increment open(STDOUT,>,$output_file) or die "Error opening $output_file for writing, "; $file_size = 0; } print $line; }

-QM
--
Quantum Mechanics: The dreams stuff is made of

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-25 04:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found