Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Is there a length limit to a string? In a flat file?

( #133747=categorized question: print w/ replies, xml ) Need Help??
Contributed by kiat on Dec 21, 2001 at 16:56 UTC
Q&A  > strings


Description:

Hi,

Is there a length limit to how long a line of text can be stored in a flat file, without any line breaks? Does having longer lines make perl more error prone, ceteris paribus?

cheers,
kiat

Answer: Is there a length limit to a string? In a flat file?
contributed by Biker

Juerd already answered this from a Perl point of view. I'll answer the file oriented part of the question:

A file does have no notion of 'lines'. A file is an ordered collection of bytes with specific values. It is the software that reads and/or writes the file that decides what a line is.

The convention says that in the DOS/Windows world a line is delimited by CRLF and that in the UNIX world a line is delimited by LF. But this is only a convention. (Which is clearly indicted by the fact that DOS and UNIX have different conventions. ;-)

As long as your file system can cope with it, you can make the file as big as you want. You can thereby store as long a 'line' as you want in the file.

Answer: Is there a length limit to a string? In a flat file?
contributed by Juerd

Perl has no string length limit.
You are only limited by the amount of memory that is available. Fortunately, having long strings does not make perl more error prone. Perl is famous for its great string capabilites.

Please (register and) log in if you wish to add an answer



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (9)
    As of 2014-07-28 20:52 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (209 votes), past polls