So far, for example, perldata documents that scalars in Perl are limited only by available memory, I strongly suspect that in real life there will be some other restrictions.
I consider the following ideas:
- I'm not sure how strings are implemented in Perl - is there any byte / character count? If there is, then it is probably implemented as a platform-specific integer (for example, 32-bit or 64-bit), so it will limit the strings to
2 ** 31 , 2 ** 32 , 2 ** 63 or 2 ** 64 bytes. - If Perl does not use a counter and instead uses some byte to break the line (which would be strange since it is normal to have a line like "foo \ 0bar" in Perl), then all operations will inevitably be much slower as the length of the line increases.
- Most of the string functions that Perl deals with strings, such as length , for example, return a normal integer scalar number, and I strongly suspect that it will be a platform-limited integer.
So, what would be other factors limiting Perl string length in real life? What can be considered a good string length for practical purposes?
string perl limit
Graycat
source share