in reply to Re^2: limit output filesize
in thread limit output filesize
It works, but -s is indeed set according to the buffer size, and not according to the already printed output:open OUT, ">test.txt"; for (1 .. 1000) { print OUT "Hello, Perlmonks!\n" x 10; print -s OUT; }
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4096 4096 4096 4096 4096 4096 4096 4096 ...
With $| set to a true value it'll work less coarse, but most likely quite a bit slower:
open OUT, ">test.txt"; my $fh = select OUT; $| = 1; select $fh; for (1 .. 1000) { print OUT "Hello, Perlmonks!\n" x 10; print -s OUT; }
192 384 576 768 960 1152 1344 1536 1728 1920 2112 2304 ...I think the coarse version is still fine enough.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: limit output filesize
by rogue90 (Novice) on Jul 08, 2005 at 19:45 UTC | |
|
Re^4: limit output filesize
by rogue90 (Novice) on Jul 08, 2005 at 19:37 UTC |