I know how to read|write|open files in perl. What am trying to achieve is this; how do I create a new file when the existing file exceeds 'x' size. For instance, I have a 3MB file size, before writing to the same file, check the size, if size exceed 3MB, create a new one, chmod it if needed, then write.
I don't know if my question is clear -
$size = -s '/path/to/file.txt';
if(($size / 1048576) > 3) { print "too big"; } else { do_something(); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With