Is there any simple means to take lines off of the top of a file without rewriting the entire file? Or better yet, is there any way to tell how big a file will be once a string is added to it?
Short answer the first: no. Longer answer, see:
Found in /usr/lib/perl5/5.6.1/pod/perlfaq5.pod How do I change one line in a file/delete a line in a file/insert a line in the middle of a file/append to the beginning of a file?
A file is an ordered stream of octets. Lines are just an illusion imposed by convention.
As for the second, presuming you're not mucking about with the file pointer and seek()ing about you can use tell() to find out where you are. That and the ever useful + operator along with length( $your_line ) should let you know. If you don't have the file open, -s/stat() would be where to look.
Update: Someone had mentioned -s/stat(). /me wanders off to get some Windex to clean the monitor and his glasses.
In reply to no one's fielded these yet
by Fletch
in thread Limit a filesize
by Flame
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |