Is there a line length limit for text files created from Perl?

前端 未结 7 1357
栀梦
栀梦 2021-01-12 08:12

While writing a Perl script, I got a requirement to write the user names with comma separation in only one line of the file.

That\'s why I would like to know is ther

7条回答
  •  萌比男神i
    2021-01-12 08:38

    Text files are just like any other files and newline character is like any othe character, so only the usual filesize restrictions apply (4Gb size limit on older file systems, file must fit on the disk etc.)

    You won't encounter any problem reading and writing it, unless you're reading it line by line—you can run out of memory then or encounter a buffer overflow of sorts. This may happen in any text editor or text processing program (such as sed or awk), because, unlike OS kernel, in those line separation matters

    I would suggest keeping one user per line, as it's more natural to read and less error-prone when you process the file with an external program.

提交回复
热议问题