Welcome to PerlMonks!

That depends on what value you assign to the variable $/. By default, it is set to the new line character (\n) but it can be set to any character or even a string with many characters. See perlvar.

Every time you read a line, Perl reads upto and including the end of line mark set in $/. To remove the end of line mark from a line you just read in, you use chomp. You may also find this link in the perl documentation helpful: How-can-I-read-in-an-entire-file-all-at-once?.

In the future you may want to consider asking simple questions about the meaning of terms in the chatter box (look for it on the sidebar on the right). In the chatterbox we can quickly go back and forth to clear up any misunderstandings. Another comment: I strongly encourage you to follow those documentation links. Perl documentation can be hard to read when you are first beginning, but the more you do it, the easier it gets. The more you expose yourself to programming jargon, the faster you will progress.

Best, beth


In reply to Re: Reading lines from a file by ELISHEVA
in thread Reading lines from a file by trewq

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.