On Thu, Apr 8, 2010 at 2:26 PM, Chris Coggins <cacogg...@cox.net> wrote:
> Is there a limit to the length of a string in perl? I'm combining about 200 > pieces of data into a single string and writing the string to a file and am > getting some weird behaviors every once in a while. Does perl have a limit > on the length of a string it writes to a simple file? > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > > Hi Chris, Perl has no string length limit. You are only limited by the amount of memory that is available. If your program is misbehaving then I fear it is the programs error (or well the person that wrote it ;-) rather then perl or any limit on the length of a string. On an average machine these days I would say you can store the equivalent of all the characters in a small library in your string before you start running out of memory. So I would not worry about 200 pieces of data. The last time I ran into a memory problem I was working with several sets of a few million strings stored in hashes and arrays that I was mixing and matching in a well not very elegant way (emergency solution needed to work now rather then in 5 minutes, at least that is my story and I'm sticking to it)... a few hundred even when they are very long should not cause an issue at all. Regards, Rob