Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Limit to Line Length?

by wardk (Deacon)
on Jan 26, 2001 at 21:35 UTC ( [id://54579]=note: print w/replies, xml ) Need Help??


in reply to Limit to Line Length?

While I don't directly know the answer to this, and is likely operating system dependant, this is a great opportunity to use perl to find out. Write a script to create successively longer lines, prefixed by the length. if the lines are missing due to length issues, you should be able to ascertain what that number is for your platform pretty easily. the max length should be length of the last line + 1

Are you *sure* the missing lines are related to a logic issue? or perhaps a limitation in your text editor?

Replies are listed 'Best First'.
Re: Re: Limit to Line Length?
by mr.nick (Chaplain) on Jan 26, 2001 at 21:41 UTC
    Good idea! I just wrote the following and am executing it as we speak (it's at 1_400_000 right now):
    #!/usr/bin/perl my $l=600_000; while (1) { print "\rTesting $l..."; open OUT,">biglines.txt" || die; print OUT "x" x $l; close OUT; open IN,"<biglines.txt" || die; my $r=<IN>; close IN; if (length($r)!=$l) { print "Oops! A linelength of $l fails!!\n"; exit; } $l+=5000; }
    It doesn't have good resolution, but it would take it years to try all the possible lengths.

    (12:01pm EST) Addendum: well, it's up to 25_000_000 characters on a line and still no problems!

    (2:28pm EST) Well, I finally stopped it from executing at approximately 65MB per line :) At this point I'd say that there is no theorectical line-length-limit, at least under Linux. I would be interested, though, to see if Perl under NT lacks the same limitation.
Re: Re: Limit to Line Length?
by dws (Chancellor) on Jan 26, 2001 at 22:52 UTC
    Don't bump by 1 -- Bump by 1024, then start backing off by 1 when you fail. The test will run a lot faster.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://54579]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-20 02:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found